From 37f0e135aa9311a37549056d1f7e34946c01c73f Mon Sep 17 00:00:00 2001 From: Casper van Donderen Date: Mon, 4 Jul 2011 12:11:38 +0200 Subject: Move the demos to the examples folder. Change-Id: I094383099bf116357a3bb6eed0052d6d14408558 Reviewed-on: http://codereview.qt.nokia.com/1059 Reviewed-by: Qt Sanity Bot Reviewed-by: Casper van Donderen --- demos/declarative/calculator/Core/Button.qml | 80 ----- demos/declarative/calculator/Core/Display.qml | 68 ---- demos/declarative/calculator/Core/calculator.js | 91 ----- .../declarative/calculator/Core/images/button-.png | Bin 1288 -> 0 bytes .../calculator/Core/images/button-blue.png | Bin 1565 -> 0 bytes .../calculator/Core/images/button-green.png | Bin 1543 -> 0 bytes .../calculator/Core/images/button-purple.png | Bin 1566 -> 0 bytes .../calculator/Core/images/button-red.png | Bin 1586 -> 0 bytes .../declarative/calculator/Core/images/display.png | Bin 998 -> 0 bytes demos/declarative/calculator/Core/qmldir | 2 - demos/declarative/calculator/calculator.qml | 162 --------- demos/declarative/calculator/calculator.qmlproject | 16 - demos/declarative/declarative.pro | 20 -- demos/declarative/demos.qmlproject | 16 - demos/declarative/flickr/content/Button.qml | 79 ----- demos/declarative/flickr/content/GridDelegate.qml | 111 ------ demos/declarative/flickr/content/ImageDetails.qml | 355 ------------------- demos/declarative/flickr/content/ListDelegate.qml | 64 ---- demos/declarative/flickr/content/Progress.qml | 88 ----- demos/declarative/flickr/content/RssModel.qml | 66 ---- demos/declarative/flickr/content/ScrollBar.qml | 81 ----- demos/declarative/flickr/content/Slider.qml | 91 ----- demos/declarative/flickr/content/StreamView.qml | 107 ------ demos/declarative/flickr/content/TitleBar.qml | 128 ------- demos/declarative/flickr/content/ToolBar.qml | 69 ---- .../declarative/flickr/content/UnifiedDelegate.qml | 162 --------- demos/declarative/flickr/content/images/gloss.png | Bin 1236 -> 0 bytes .../declarative/flickr/content/images/lineedit.png | Bin 1415 -> 0 bytes .../declarative/flickr/content/images/lineedit.sci | 5 - demos/declarative/flickr/content/images/noise.png | Bin 25447 -> 0 bytes .../declarative/flickr/content/images/particle.png | Bin 5148 -> 0 bytes demos/declarative/flickr/content/images/quit.png | Bin 2369 -> 0 bytes .../flickr/content/images/squareParticle.png | Bin 933 -> 0 bytes .../declarative/flickr/content/images/stripes.png | Bin 257 -> 0 bytes .../declarative/flickr/content/images/titlebar.png | Bin 1436 -> 0 bytes .../declarative/flickr/content/images/titlebar.sci | 5 - .../flickr/content/images/toolbutton.png | Bin 2550 -> 0 bytes .../flickr/content/images/toolbutton.sci | 5 - demos/declarative/flickr/content/qmldir | 10 - demos/declarative/flickr/flickr-90.qml | 52 --- demos/declarative/flickr/flickr.qml | 166 --------- demos/declarative/flickr/flickr.qmlproject | 16 - .../minehunt/MinehuntCore/Explosion.qml | 66 ---- demos/declarative/minehunt/MinehuntCore/Tile.qml | 128 ------- .../minehunt/MinehuntCore/pics/back.png | Bin 558 -> 0 bytes .../minehunt/MinehuntCore/pics/background.png | Bin 313930 -> 0 bytes .../minehunt/MinehuntCore/pics/bomb-color.png | Bin 284 -> 0 bytes .../minehunt/MinehuntCore/pics/bomb.png | Bin 535 -> 0 bytes .../minehunt/MinehuntCore/pics/face-sad.png | Bin 14844 -> 0 bytes .../minehunt/MinehuntCore/pics/face-smile-big.png | Bin 13810 -> 0 bytes .../minehunt/MinehuntCore/pics/face-smile.png | Bin 15408 -> 0 bytes .../minehunt/MinehuntCore/pics/flag-color.png | Bin 219 -> 0 bytes .../minehunt/MinehuntCore/pics/flag.png | Bin 196 -> 0 bytes .../minehunt/MinehuntCore/pics/front.png | Bin 580 -> 0 bytes .../minehunt/MinehuntCore/pics/quit.png | Bin 583 -> 0 bytes .../minehunt/MinehuntCore/pics/star.png | Bin 2677 -> 0 bytes demos/declarative/minehunt/MinehuntCore/qmldir | 2 - demos/declarative/minehunt/README | 6 - demos/declarative/minehunt/main.cpp | 71 ---- demos/declarative/minehunt/minehunt.cpp | 221 ------------ demos/declarative/minehunt/minehunt.h | 129 ------- demos/declarative/minehunt/minehunt.pro | 23 -- demos/declarative/minehunt/minehunt.qml | 112 ------ demos/declarative/minehunt/minehunt.qmlproject | 16 - demos/declarative/minehunt/minehunt.qrc | 20 -- .../photoviewer/PhotoViewerCore/AlbumDelegate.qml | 146 -------- .../photoviewer/PhotoViewerCore/BusyIndicator.qml | 50 --- .../photoviewer/PhotoViewerCore/Button.qml | 72 ---- .../photoviewer/PhotoViewerCore/EditableButton.qml | 86 ----- .../photoviewer/PhotoViewerCore/PhotoDelegate.qml | 188 ---------- .../photoviewer/PhotoViewerCore/ProgressBar.qml | 57 --- .../photoviewer/PhotoViewerCore/RssModel.qml | 54 --- .../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 .../declarative/photoviewer/PhotoViewerCore/qmldir | 8 - .../photoviewer/PhotoViewerCore/script/script.js | 27 -- demos/declarative/photoviewer/i18n/base.ts | 30 -- demos/declarative/photoviewer/i18n/qml_fr.qm | Bin 268 -> 0 bytes demos/declarative/photoviewer/i18n/qml_fr.ts | 30 -- demos/declarative/photoviewer/photoviewer.qml | 110 ------ .../declarative/photoviewer/photoviewer.qmlproject | 16 - .../plasmapatrol/PlasmaPatrol.qmlproject | 18 - demos/declarative/plasmapatrol/TODO | 10 - .../plasmapatrol/content/BlasterHardpoint.qml | 133 ------- demos/declarative/plasmapatrol/content/Button.qml | 66 ---- .../plasmapatrol/content/CannonHardpoint.qml | 97 ------ .../declarative/plasmapatrol/content/ChoiceBox.qml | 105 ------ demos/declarative/plasmapatrol/content/Cruiser.qml | 146 -------- demos/declarative/plasmapatrol/content/Frigate.qml | 114 ------ .../declarative/plasmapatrol/content/Hardpoint.qml | 112 ------ .../plasmapatrol/content/HelpScreens.qml | 268 -------------- .../plasmapatrol/content/LaserHardpoint.qml | 108 ------ .../plasmapatrol/content/PlasmaPatrolParticles.qml | 173 --------- .../plasmapatrol/content/SequentialLoader.qml | 54 --- demos/declarative/plasmapatrol/content/Ship.qml | 113 ------ demos/declarative/plasmapatrol/content/Sloop.qml | 108 ------ .../plasmapatrol/content/pics/TitleText.png | Bin 1109 -> 0 bytes .../plasmapatrol/content/pics/blur-circle2.png | Bin 3627 -> 0 bytes .../plasmapatrol/content/pics/blur-circle3.png | Bin 5148 -> 0 bytes .../plasmapatrol/content/pics/finalfrontier.png | Bin 695061 -> 0 bytes .../plasmapatrol/content/pics/meteor.png | Bin 83169 -> 0 bytes .../plasmapatrol/content/pics/meteor_explo.png | Bin 81528 -> 0 bytes .../plasmapatrol/content/pics/nullRock.png | Bin 140 -> 0 bytes .../plasmapatrol/content/pics/particle.png | Bin 861 -> 0 bytes .../declarative/plasmapatrol/content/pics/star.png | Bin 1550 -> 0 bytes .../plasmapatrol/content/pics/star2.png | Bin 6507 -> 0 bytes .../plasmapatrol/content/pics/star3.png | Bin 4602 -> 0 bytes demos/declarative/plasmapatrol/plasmapatrol.qml | 386 --------------------- .../declarative/rssnews/content/BusyIndicator.qml | 53 --- .../rssnews/content/CategoryDelegate.qml | 82 ----- demos/declarative/rssnews/content/NewsDelegate.qml | 71 ---- demos/declarative/rssnews/content/RssFeeds.qml | 59 ---- demos/declarative/rssnews/content/ScrollBar.qml | 107 ------ demos/declarative/rssnews/content/images/busy.png | Bin 2629 -> 0 bytes .../rssnews/content/images/scrollbar.png | Bin 161 -> 0 bytes demos/declarative/rssnews/rssnews.qml | 111 ------ demos/declarative/rssnews/rssnews.qmlproject | 16 - .../samegame/SamegameCore/BoomBlock.qml | 111 ------ demos/declarative/samegame/SamegameCore/Button.qml | 75 ---- demos/declarative/samegame/SamegameCore/Dialog.qml | 80 ----- .../samegame/SamegameCore/pics/background.png | Bin 313930 -> 0 bytes .../samegame/SamegameCore/pics/blueStone.png | Bin 3054 -> 0 bytes .../samegame/SamegameCore/pics/greenStone.png | Bin 2932 -> 0 bytes .../samegame/SamegameCore/pics/particle.png | Bin 861 -> 0 bytes .../samegame/SamegameCore/pics/redStone.png | Bin 2902 -> 0 bytes .../samegame/SamegameCore/pics/yellowStone.png | Bin 3056 -> 0 bytes demos/declarative/samegame/SamegameCore/qmldir | 3 - .../declarative/samegame/SamegameCore/samegame.js | 288 --------------- demos/declarative/samegame/highscores/README | 1 - .../declarative/samegame/highscores/score_data.xml | 2 - .../samegame/highscores/score_style.xsl | 28 -- demos/declarative/samegame/highscores/scores.php | 34 -- demos/declarative/samegame/samegame.qml | 192 ---------- demos/declarative/samegame/samegame.qmlproject | 16 - demos/declarative/shadereffects/Slider.qml | 93 ----- demos/declarative/shadereffects/face-smile.png | Bin 15408 -> 0 bytes demos/declarative/shadereffects/qt-logo.png | Bin 13923 -> 0 bytes demos/declarative/shadereffects/shader-demo.qml | 295 ---------------- demos/declarative/snake/content/Button.qml | 66 ---- demos/declarative/snake/content/Cookie.qml | 94 ----- demos/declarative/snake/content/HighScoreModel.qml | 139 -------- demos/declarative/snake/content/Link.qml | 128 ------- demos/declarative/snake/content/Skull.qml | 62 ---- demos/declarative/snake/content/pics/README | 1 - .../declarative/snake/content/pics/background.png | Bin 144508 -> 0 bytes demos/declarative/snake/content/pics/blueStar.png | Bin 272 -> 0 bytes demos/declarative/snake/content/pics/blueStone.png | Bin 3139 -> 0 bytes demos/declarative/snake/content/pics/cookie.png | Bin 2729 -> 0 bytes demos/declarative/snake/content/pics/eyes.svg | 118 ------- demos/declarative/snake/content/pics/head.png | Bin 3473 -> 0 bytes demos/declarative/snake/content/pics/head.svg | 134 ------- demos/declarative/snake/content/pics/pause.png | Bin 4327 -> 0 bytes demos/declarative/snake/content/pics/redStar.png | Bin 273 -> 0 bytes demos/declarative/snake/content/pics/redStone.png | Bin 3456 -> 0 bytes demos/declarative/snake/content/pics/skull.png | Bin 2543 -> 0 bytes demos/declarative/snake/content/pics/snake.jpg | Bin 663901 -> 0 bytes demos/declarative/snake/content/pics/star.png | Bin 262 -> 0 bytes .../declarative/snake/content/pics/stoneShadow.png | Bin 1699 -> 0 bytes .../declarative/snake/content/pics/yellowStar.png | Bin 276 -> 0 bytes .../declarative/snake/content/pics/yellowStone.png | Bin 2667 -> 0 bytes demos/declarative/snake/content/snake.js | 316 ----------------- demos/declarative/snake/snake.qml | 272 --------------- demos/declarative/snake/snake.qmlproject | 16 - demos/declarative/twitter/TwitterCore/Button.qml | 90 ----- .../twitter/TwitterCore/FatDelegate.qml | 105 ------ demos/declarative/twitter/TwitterCore/Input.qml | 65 ---- demos/declarative/twitter/TwitterCore/Loading.qml | 49 --- .../twitter/TwitterCore/MultiTitleBar.qml | 60 ---- demos/declarative/twitter/TwitterCore/RssModel.qml | 76 ---- .../declarative/twitter/TwitterCore/SearchView.qml | 124 ------- demos/declarative/twitter/TwitterCore/TitleBar.qml | 130 ------- demos/declarative/twitter/TwitterCore/ToolBar.qml | 64 ---- .../declarative/twitter/TwitterCore/UserModel.qml | 65 ---- .../twitter/TwitterCore/images/gloss.png | Bin 1236 -> 0 bytes .../twitter/TwitterCore/images/lineedit.png | Bin 1415 -> 0 bytes .../twitter/TwitterCore/images/lineedit.sci | 5 - .../twitter/TwitterCore/images/loading.png | Bin 813 -> 0 bytes .../twitter/TwitterCore/images/quit.png | Bin 2369 -> 0 bytes .../twitter/TwitterCore/images/stripes.png | Bin 257 -> 0 bytes .../twitter/TwitterCore/images/titlebar.png | Bin 1436 -> 0 bytes .../twitter/TwitterCore/images/titlebar.sci | 5 - .../twitter/TwitterCore/images/toolbutton.png | Bin 2550 -> 0 bytes .../twitter/TwitterCore/images/toolbutton.sci | 5 - demos/declarative/twitter/TwitterCore/qmldir | 10 - demos/declarative/twitter/twitter.qml | 134 ------- demos/declarative/twitter/twitter.qmlproject | 16 - demos/demos.pro | 2 - demos/embedded/embedded.pro | 2 - demos/embedded/qmlcalculator/deployment.pri | 8 - demos/embedded/qmlcalculator/qmlcalculator.cpp | 80 ----- demos/embedded/qmlcalculator/qmlcalculator.pro | 12 - demos/embedded/qmlclocks/deployment.pri | 8 - demos/embedded/qmlclocks/qmlclocks.cpp | 80 ----- demos/embedded/qmlclocks/qmlclocks.pro | 12 - demos/embedded/qmldialcontrol/deployment.pri | 8 - demos/embedded/qmldialcontrol/qmldialcontrol.cpp | 68 ---- demos/embedded/qmldialcontrol/qmldialcontrol.pro | 11 - demos/embedded/qmleasing/deployment.pri | 8 - demos/embedded/qmleasing/qmleasing.cpp | 68 ---- demos/embedded/qmleasing/qmleasing.pro | 11 - demos/embedded/qmlflickr/deployment.pri | 8 - demos/embedded/qmlflickr/qmlflickr.cpp | 109 ------ demos/embedded/qmlflickr/qmlflickr.pro | 13 - demos/embedded/qmlphotoviewer/deployment.pri | 8 - demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp | 109 ------ demos/embedded/qmlphotoviewer/qmlphotoviewer.pro | 12 - demos/embedded/qmltwitter/deployment.pri | 8 - demos/embedded/qmltwitter/qmltwitter.cpp | 108 ------ demos/embedded/qmltwitter/qmltwitter.pro | 12 - examples/declarative/calculator/Core/Button.qml | 80 +++++ examples/declarative/calculator/Core/Display.qml | 68 ++++ examples/declarative/calculator/Core/calculator.js | 91 +++++ .../declarative/calculator/Core/images/button-.png | Bin 0 -> 1288 bytes .../calculator/Core/images/button-blue.png | Bin 0 -> 1565 bytes .../calculator/Core/images/button-green.png | Bin 0 -> 1543 bytes .../calculator/Core/images/button-purple.png | Bin 0 -> 1566 bytes .../calculator/Core/images/button-red.png | Bin 0 -> 1586 bytes .../declarative/calculator/Core/images/display.png | Bin 0 -> 998 bytes examples/declarative/calculator/Core/qmldir | 2 + examples/declarative/calculator/calculator.qml | 162 +++++++++ .../declarative/calculator/calculator.qmlproject | 16 + examples/declarative/declarative.pro | 14 +- examples/declarative/flickr/content/Button.qml | 79 +++++ .../declarative/flickr/content/GridDelegate.qml | 111 ++++++ .../declarative/flickr/content/ImageDetails.qml | 355 +++++++++++++++++++ .../declarative/flickr/content/ListDelegate.qml | 64 ++++ examples/declarative/flickr/content/Progress.qml | 88 +++++ examples/declarative/flickr/content/RssModel.qml | 66 ++++ examples/declarative/flickr/content/ScrollBar.qml | 81 +++++ examples/declarative/flickr/content/Slider.qml | 91 +++++ examples/declarative/flickr/content/StreamView.qml | 107 ++++++ examples/declarative/flickr/content/TitleBar.qml | 128 +++++++ examples/declarative/flickr/content/ToolBar.qml | 69 ++++ .../declarative/flickr/content/UnifiedDelegate.qml | 162 +++++++++ .../declarative/flickr/content/images/gloss.png | Bin 0 -> 1236 bytes .../declarative/flickr/content/images/lineedit.png | Bin 0 -> 1415 bytes .../declarative/flickr/content/images/lineedit.sci | 5 + .../declarative/flickr/content/images/noise.png | Bin 0 -> 25447 bytes .../declarative/flickr/content/images/particle.png | Bin 0 -> 5148 bytes .../declarative/flickr/content/images/quit.png | Bin 0 -> 2369 bytes .../flickr/content/images/squareParticle.png | Bin 0 -> 933 bytes .../declarative/flickr/content/images/stripes.png | Bin 0 -> 257 bytes .../declarative/flickr/content/images/titlebar.png | Bin 0 -> 1436 bytes .../declarative/flickr/content/images/titlebar.sci | 5 + .../flickr/content/images/toolbutton.png | Bin 0 -> 2550 bytes .../flickr/content/images/toolbutton.sci | 5 + examples/declarative/flickr/content/qmldir | 10 + examples/declarative/flickr/flickr-90.qml | 52 +++ examples/declarative/flickr/flickr.qml | 166 +++++++++ examples/declarative/flickr/flickr.qmlproject | 16 + .../minehunt/MinehuntCore/Explosion.qml | 66 ++++ .../declarative/minehunt/MinehuntCore/Tile.qml | 128 +++++++ .../minehunt/MinehuntCore/pics/back.png | Bin 0 -> 558 bytes .../minehunt/MinehuntCore/pics/background.png | Bin 0 -> 313930 bytes .../minehunt/MinehuntCore/pics/bomb-color.png | Bin 0 -> 284 bytes .../minehunt/MinehuntCore/pics/bomb.png | Bin 0 -> 535 bytes .../minehunt/MinehuntCore/pics/face-sad.png | Bin 0 -> 14844 bytes .../minehunt/MinehuntCore/pics/face-smile-big.png | Bin 0 -> 13810 bytes .../minehunt/MinehuntCore/pics/face-smile.png | Bin 0 -> 15408 bytes .../minehunt/MinehuntCore/pics/flag-color.png | Bin 0 -> 219 bytes .../minehunt/MinehuntCore/pics/flag.png | Bin 0 -> 196 bytes .../minehunt/MinehuntCore/pics/front.png | Bin 0 -> 580 bytes .../minehunt/MinehuntCore/pics/quit.png | Bin 0 -> 583 bytes .../minehunt/MinehuntCore/pics/star.png | Bin 0 -> 2677 bytes examples/declarative/minehunt/MinehuntCore/qmldir | 2 + examples/declarative/minehunt/README | 6 + examples/declarative/minehunt/main.cpp | 71 ++++ examples/declarative/minehunt/minehunt.cpp | 221 ++++++++++++ examples/declarative/minehunt/minehunt.h | 129 +++++++ examples/declarative/minehunt/minehunt.pro | 23 ++ examples/declarative/minehunt/minehunt.qml | 112 ++++++ examples/declarative/minehunt/minehunt.qmlproject | 16 + examples/declarative/minehunt/minehunt.qrc | 20 ++ .../photoviewer/PhotoViewerCore/AlbumDelegate.qml | 146 ++++++++ .../photoviewer/PhotoViewerCore/BusyIndicator.qml | 50 +++ .../photoviewer/PhotoViewerCore/Button.qml | 72 ++++ .../photoviewer/PhotoViewerCore/EditableButton.qml | 86 +++++ .../photoviewer/PhotoViewerCore/PhotoDelegate.qml | 188 ++++++++++ .../photoviewer/PhotoViewerCore/ProgressBar.qml | 57 +++ .../photoviewer/PhotoViewerCore/RssModel.qml | 54 +++ .../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 .../declarative/photoviewer/PhotoViewerCore/qmldir | 8 + .../photoviewer/PhotoViewerCore/script/script.js | 27 ++ examples/declarative/photoviewer/i18n/base.ts | 30 ++ examples/declarative/photoviewer/i18n/qml_fr.qm | Bin 0 -> 268 bytes examples/declarative/photoviewer/i18n/qml_fr.ts | 30 ++ examples/declarative/photoviewer/photoviewer.qml | 110 ++++++ .../declarative/photoviewer/photoviewer.qmlproject | 16 + .../plasmapatrol/PlasmaPatrol.qmlproject | 18 + examples/declarative/plasmapatrol/TODO | 10 + .../plasmapatrol/content/BlasterHardpoint.qml | 133 +++++++ .../declarative/plasmapatrol/content/Button.qml | 66 ++++ .../plasmapatrol/content/CannonHardpoint.qml | 97 ++++++ .../declarative/plasmapatrol/content/ChoiceBox.qml | 105 ++++++ .../declarative/plasmapatrol/content/Cruiser.qml | 146 ++++++++ .../declarative/plasmapatrol/content/Frigate.qml | 114 ++++++ .../declarative/plasmapatrol/content/Hardpoint.qml | 112 ++++++ .../plasmapatrol/content/HelpScreens.qml | 268 ++++++++++++++ .../plasmapatrol/content/LaserHardpoint.qml | 108 ++++++ .../plasmapatrol/content/PlasmaPatrolParticles.qml | 173 +++++++++ .../plasmapatrol/content/SequentialLoader.qml | 54 +++ examples/declarative/plasmapatrol/content/Ship.qml | 113 ++++++ .../declarative/plasmapatrol/content/Sloop.qml | 108 ++++++ .../plasmapatrol/content/pics/TitleText.png | Bin 0 -> 1109 bytes .../plasmapatrol/content/pics/blur-circle2.png | Bin 0 -> 3627 bytes .../plasmapatrol/content/pics/blur-circle3.png | Bin 0 -> 5148 bytes .../plasmapatrol/content/pics/finalfrontier.png | Bin 0 -> 695061 bytes .../plasmapatrol/content/pics/meteor.png | Bin 0 -> 83169 bytes .../plasmapatrol/content/pics/meteor_explo.png | Bin 0 -> 81528 bytes .../plasmapatrol/content/pics/nullRock.png | Bin 0 -> 140 bytes .../plasmapatrol/content/pics/particle.png | Bin 0 -> 861 bytes .../declarative/plasmapatrol/content/pics/star.png | Bin 0 -> 1550 bytes .../plasmapatrol/content/pics/star2.png | Bin 0 -> 6507 bytes .../plasmapatrol/content/pics/star3.png | Bin 0 -> 4602 bytes examples/declarative/plasmapatrol/plasmapatrol.qml | 386 +++++++++++++++++++++ .../declarative/rssnews/content/BusyIndicator.qml | 53 +++ .../rssnews/content/CategoryDelegate.qml | 82 +++++ .../declarative/rssnews/content/NewsDelegate.qml | 71 ++++ examples/declarative/rssnews/content/RssFeeds.qml | 59 ++++ examples/declarative/rssnews/content/ScrollBar.qml | 107 ++++++ .../declarative/rssnews/content/images/busy.png | Bin 0 -> 2629 bytes .../rssnews/content/images/scrollbar.png | Bin 0 -> 161 bytes examples/declarative/rssnews/rssnews.qml | 111 ++++++ examples/declarative/rssnews/rssnews.qmlproject | 16 + .../samegame/SamegameCore/BoomBlock.qml | 111 ++++++ .../declarative/samegame/SamegameCore/Button.qml | 75 ++++ .../declarative/samegame/SamegameCore/Dialog.qml | 80 +++++ .../samegame/SamegameCore/pics/background.png | Bin 0 -> 313930 bytes .../samegame/SamegameCore/pics/blueStone.png | Bin 0 -> 3054 bytes .../samegame/SamegameCore/pics/greenStone.png | Bin 0 -> 2932 bytes .../samegame/SamegameCore/pics/particle.png | Bin 0 -> 861 bytes .../samegame/SamegameCore/pics/redStone.png | Bin 0 -> 2902 bytes .../samegame/SamegameCore/pics/yellowStone.png | Bin 0 -> 3056 bytes examples/declarative/samegame/SamegameCore/qmldir | 3 + .../declarative/samegame/SamegameCore/samegame.js | 288 +++++++++++++++ examples/declarative/samegame/highscores/README | 1 + .../declarative/samegame/highscores/score_data.xml | 2 + .../samegame/highscores/score_style.xsl | 28 ++ .../declarative/samegame/highscores/scores.php | 34 ++ examples/declarative/samegame/samegame.qml | 192 ++++++++++ examples/declarative/samegame/samegame.qmlproject | 16 + examples/declarative/shadereffects/Slider.qml | 93 +++++ examples/declarative/shadereffects/face-smile.png | Bin 0 -> 15408 bytes examples/declarative/shadereffects/qt-logo.png | Bin 0 -> 13923 bytes examples/declarative/shadereffects/shader-demo.qml | 295 ++++++++++++++++ examples/declarative/snake/content/Button.qml | 66 ++++ examples/declarative/snake/content/Cookie.qml | 94 +++++ .../declarative/snake/content/HighScoreModel.qml | 139 ++++++++ examples/declarative/snake/content/Link.qml | 128 +++++++ examples/declarative/snake/content/Skull.qml | 62 ++++ examples/declarative/snake/content/pics/README | 1 + .../declarative/snake/content/pics/background.png | Bin 0 -> 144508 bytes .../declarative/snake/content/pics/blueStar.png | Bin 0 -> 272 bytes .../declarative/snake/content/pics/blueStone.png | Bin 0 -> 3139 bytes examples/declarative/snake/content/pics/cookie.png | Bin 0 -> 2729 bytes examples/declarative/snake/content/pics/eyes.svg | 118 +++++++ examples/declarative/snake/content/pics/head.png | Bin 0 -> 3473 bytes examples/declarative/snake/content/pics/head.svg | 134 +++++++ examples/declarative/snake/content/pics/pause.png | Bin 0 -> 4327 bytes .../declarative/snake/content/pics/redStar.png | Bin 0 -> 273 bytes .../declarative/snake/content/pics/redStone.png | Bin 0 -> 3456 bytes examples/declarative/snake/content/pics/skull.png | Bin 0 -> 2543 bytes examples/declarative/snake/content/pics/snake.jpg | Bin 0 -> 663901 bytes examples/declarative/snake/content/pics/star.png | Bin 0 -> 262 bytes .../declarative/snake/content/pics/stoneShadow.png | Bin 0 -> 1699 bytes .../declarative/snake/content/pics/yellowStar.png | Bin 0 -> 276 bytes .../declarative/snake/content/pics/yellowStone.png | Bin 0 -> 2667 bytes examples/declarative/snake/content/snake.js | 316 +++++++++++++++++ examples/declarative/snake/snake.qml | 272 +++++++++++++++ examples/declarative/snake/snake.qmlproject | 16 + .../declarative/twitter/TwitterCore/Button.qml | 90 +++++ .../twitter/TwitterCore/FatDelegate.qml | 105 ++++++ examples/declarative/twitter/TwitterCore/Input.qml | 65 ++++ .../declarative/twitter/TwitterCore/Loading.qml | 49 +++ .../twitter/TwitterCore/MultiTitleBar.qml | 60 ++++ .../declarative/twitter/TwitterCore/RssModel.qml | 76 ++++ .../declarative/twitter/TwitterCore/SearchView.qml | 124 +++++++ .../declarative/twitter/TwitterCore/TitleBar.qml | 130 +++++++ .../declarative/twitter/TwitterCore/ToolBar.qml | 64 ++++ .../declarative/twitter/TwitterCore/UserModel.qml | 65 ++++ .../twitter/TwitterCore/images/gloss.png | Bin 0 -> 1236 bytes .../twitter/TwitterCore/images/lineedit.png | Bin 0 -> 1415 bytes .../twitter/TwitterCore/images/lineedit.sci | 5 + .../twitter/TwitterCore/images/loading.png | Bin 0 -> 813 bytes .../twitter/TwitterCore/images/quit.png | Bin 0 -> 2369 bytes .../twitter/TwitterCore/images/stripes.png | Bin 0 -> 257 bytes .../twitter/TwitterCore/images/titlebar.png | Bin 0 -> 1436 bytes .../twitter/TwitterCore/images/titlebar.sci | 5 + .../twitter/TwitterCore/images/toolbutton.png | Bin 0 -> 2550 bytes .../twitter/TwitterCore/images/toolbutton.sci | 5 + examples/declarative/twitter/TwitterCore/qmldir | 10 + examples/declarative/twitter/twitter.qml | 134 +++++++ examples/declarative/twitter/twitter.qmlproject | 16 + examples/embedded/embedded.pro | 2 + examples/embedded/qmlcalculator/deployment.pri | 8 + examples/embedded/qmlcalculator/qmlcalculator.cpp | 80 +++++ examples/embedded/qmlcalculator/qmlcalculator.pro | 12 + examples/embedded/qmlclocks/deployment.pri | 8 + examples/embedded/qmlclocks/qmlclocks.cpp | 80 +++++ examples/embedded/qmlclocks/qmlclocks.pro | 12 + examples/embedded/qmldialcontrol/deployment.pri | 8 + .../embedded/qmldialcontrol/qmldialcontrol.cpp | 68 ++++ .../embedded/qmldialcontrol/qmldialcontrol.pro | 11 + examples/embedded/qmleasing/deployment.pri | 8 + examples/embedded/qmleasing/qmleasing.cpp | 68 ++++ examples/embedded/qmleasing/qmleasing.pro | 11 + examples/embedded/qmlflickr/deployment.pri | 8 + examples/embedded/qmlflickr/qmlflickr.cpp | 109 ++++++ examples/embedded/qmlflickr/qmlflickr.pro | 13 + examples/embedded/qmlphotoviewer/deployment.pri | 8 + .../embedded/qmlphotoviewer/qmlphotoviewer.cpp | 109 ++++++ .../embedded/qmlphotoviewer/qmlphotoviewer.pro | 12 + examples/embedded/qmltwitter/deployment.pri | 8 + examples/embedded/qmltwitter/qmltwitter.cpp | 108 ++++++ examples/embedded/qmltwitter/qmltwitter.pro | 12 + qtdeclarative.pro | 8 - 421 files changed, 10690 insertions(+), 10726 deletions(-) delete mode 100644 demos/declarative/calculator/Core/Button.qml delete mode 100644 demos/declarative/calculator/Core/Display.qml delete mode 100644 demos/declarative/calculator/Core/calculator.js delete mode 100644 demos/declarative/calculator/Core/images/button-.png delete mode 100644 demos/declarative/calculator/Core/images/button-blue.png delete mode 100644 demos/declarative/calculator/Core/images/button-green.png delete mode 100644 demos/declarative/calculator/Core/images/button-purple.png delete mode 100644 demos/declarative/calculator/Core/images/button-red.png delete mode 100644 demos/declarative/calculator/Core/images/display.png delete mode 100644 demos/declarative/calculator/Core/qmldir delete mode 100644 demos/declarative/calculator/calculator.qml delete mode 100644 demos/declarative/calculator/calculator.qmlproject delete mode 100644 demos/declarative/declarative.pro delete mode 100644 demos/declarative/demos.qmlproject delete mode 100644 demos/declarative/flickr/content/Button.qml delete mode 100644 demos/declarative/flickr/content/GridDelegate.qml delete mode 100644 demos/declarative/flickr/content/ImageDetails.qml delete mode 100644 demos/declarative/flickr/content/ListDelegate.qml delete mode 100644 demos/declarative/flickr/content/Progress.qml delete mode 100644 demos/declarative/flickr/content/RssModel.qml delete mode 100644 demos/declarative/flickr/content/ScrollBar.qml delete mode 100644 demos/declarative/flickr/content/Slider.qml delete mode 100644 demos/declarative/flickr/content/StreamView.qml delete mode 100644 demos/declarative/flickr/content/TitleBar.qml delete mode 100644 demos/declarative/flickr/content/ToolBar.qml delete mode 100644 demos/declarative/flickr/content/UnifiedDelegate.qml delete mode 100644 demos/declarative/flickr/content/images/gloss.png delete mode 100644 demos/declarative/flickr/content/images/lineedit.png delete mode 100644 demos/declarative/flickr/content/images/lineedit.sci delete mode 100644 demos/declarative/flickr/content/images/noise.png delete mode 100644 demos/declarative/flickr/content/images/particle.png delete mode 100644 demos/declarative/flickr/content/images/quit.png delete mode 100644 demos/declarative/flickr/content/images/squareParticle.png delete mode 100644 demos/declarative/flickr/content/images/stripes.png delete mode 100644 demos/declarative/flickr/content/images/titlebar.png delete mode 100644 demos/declarative/flickr/content/images/titlebar.sci delete mode 100644 demos/declarative/flickr/content/images/toolbutton.png delete mode 100644 demos/declarative/flickr/content/images/toolbutton.sci delete mode 100644 demos/declarative/flickr/content/qmldir delete mode 100644 demos/declarative/flickr/flickr-90.qml delete mode 100644 demos/declarative/flickr/flickr.qml delete mode 100644 demos/declarative/flickr/flickr.qmlproject delete mode 100644 demos/declarative/minehunt/MinehuntCore/Explosion.qml delete mode 100644 demos/declarative/minehunt/MinehuntCore/Tile.qml delete mode 100644 demos/declarative/minehunt/MinehuntCore/pics/back.png delete mode 100644 demos/declarative/minehunt/MinehuntCore/pics/background.png delete mode 100644 demos/declarative/minehunt/MinehuntCore/pics/bomb-color.png delete mode 100644 demos/declarative/minehunt/MinehuntCore/pics/bomb.png delete mode 100644 demos/declarative/minehunt/MinehuntCore/pics/face-sad.png delete mode 100644 demos/declarative/minehunt/MinehuntCore/pics/face-smile-big.png delete mode 100644 demos/declarative/minehunt/MinehuntCore/pics/face-smile.png delete mode 100644 demos/declarative/minehunt/MinehuntCore/pics/flag-color.png delete mode 100644 demos/declarative/minehunt/MinehuntCore/pics/flag.png delete mode 100644 demos/declarative/minehunt/MinehuntCore/pics/front.png delete mode 100644 demos/declarative/minehunt/MinehuntCore/pics/quit.png delete mode 100644 demos/declarative/minehunt/MinehuntCore/pics/star.png delete mode 100644 demos/declarative/minehunt/MinehuntCore/qmldir delete mode 100644 demos/declarative/minehunt/README delete mode 100644 demos/declarative/minehunt/main.cpp delete mode 100644 demos/declarative/minehunt/minehunt.cpp delete mode 100644 demos/declarative/minehunt/minehunt.h delete mode 100644 demos/declarative/minehunt/minehunt.pro delete mode 100644 demos/declarative/minehunt/minehunt.qml delete mode 100644 demos/declarative/minehunt/minehunt.qmlproject delete mode 100644 demos/declarative/minehunt/minehunt.qrc delete mode 100644 demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml delete mode 100644 demos/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml delete mode 100644 demos/declarative/photoviewer/PhotoViewerCore/Button.qml delete mode 100644 demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml delete mode 100644 demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml delete mode 100644 demos/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml delete mode 100644 demos/declarative/photoviewer/PhotoViewerCore/RssModel.qml delete mode 100644 demos/declarative/photoviewer/PhotoViewerCore/Tag.qml delete mode 100644 demos/declarative/photoviewer/PhotoViewerCore/images/box-shadow.png delete mode 100644 demos/declarative/photoviewer/PhotoViewerCore/images/busy.png delete mode 100644 demos/declarative/photoviewer/PhotoViewerCore/images/cardboard.png delete mode 100644 demos/declarative/photoviewer/PhotoViewerCore/qmldir delete mode 100644 demos/declarative/photoviewer/PhotoViewerCore/script/script.js delete mode 100644 demos/declarative/photoviewer/i18n/base.ts delete mode 100644 demos/declarative/photoviewer/i18n/qml_fr.qm delete mode 100644 demos/declarative/photoviewer/i18n/qml_fr.ts delete mode 100644 demos/declarative/photoviewer/photoviewer.qml delete mode 100644 demos/declarative/photoviewer/photoviewer.qmlproject delete mode 100644 demos/declarative/plasmapatrol/PlasmaPatrol.qmlproject delete mode 100644 demos/declarative/plasmapatrol/TODO delete mode 100644 demos/declarative/plasmapatrol/content/BlasterHardpoint.qml delete mode 100644 demos/declarative/plasmapatrol/content/Button.qml delete mode 100644 demos/declarative/plasmapatrol/content/CannonHardpoint.qml delete mode 100644 demos/declarative/plasmapatrol/content/ChoiceBox.qml delete mode 100644 demos/declarative/plasmapatrol/content/Cruiser.qml delete mode 100644 demos/declarative/plasmapatrol/content/Frigate.qml delete mode 100644 demos/declarative/plasmapatrol/content/Hardpoint.qml delete mode 100644 demos/declarative/plasmapatrol/content/HelpScreens.qml delete mode 100644 demos/declarative/plasmapatrol/content/LaserHardpoint.qml delete mode 100644 demos/declarative/plasmapatrol/content/PlasmaPatrolParticles.qml delete mode 100644 demos/declarative/plasmapatrol/content/SequentialLoader.qml delete mode 100644 demos/declarative/plasmapatrol/content/Ship.qml delete mode 100644 demos/declarative/plasmapatrol/content/Sloop.qml delete mode 100644 demos/declarative/plasmapatrol/content/pics/TitleText.png delete mode 100644 demos/declarative/plasmapatrol/content/pics/blur-circle2.png delete mode 100644 demos/declarative/plasmapatrol/content/pics/blur-circle3.png delete mode 100644 demos/declarative/plasmapatrol/content/pics/finalfrontier.png delete mode 100644 demos/declarative/plasmapatrol/content/pics/meteor.png delete mode 100644 demos/declarative/plasmapatrol/content/pics/meteor_explo.png delete mode 100644 demos/declarative/plasmapatrol/content/pics/nullRock.png delete mode 100644 demos/declarative/plasmapatrol/content/pics/particle.png delete mode 100644 demos/declarative/plasmapatrol/content/pics/star.png delete mode 100644 demos/declarative/plasmapatrol/content/pics/star2.png delete mode 100644 demos/declarative/plasmapatrol/content/pics/star3.png delete mode 100644 demos/declarative/plasmapatrol/plasmapatrol.qml delete mode 100644 demos/declarative/rssnews/content/BusyIndicator.qml delete mode 100644 demos/declarative/rssnews/content/CategoryDelegate.qml delete mode 100644 demos/declarative/rssnews/content/NewsDelegate.qml delete mode 100644 demos/declarative/rssnews/content/RssFeeds.qml delete mode 100644 demos/declarative/rssnews/content/ScrollBar.qml delete mode 100644 demos/declarative/rssnews/content/images/busy.png delete mode 100644 demos/declarative/rssnews/content/images/scrollbar.png delete mode 100644 demos/declarative/rssnews/rssnews.qml delete mode 100644 demos/declarative/rssnews/rssnews.qmlproject delete mode 100644 demos/declarative/samegame/SamegameCore/BoomBlock.qml delete mode 100644 demos/declarative/samegame/SamegameCore/Button.qml delete mode 100644 demos/declarative/samegame/SamegameCore/Dialog.qml delete mode 100644 demos/declarative/samegame/SamegameCore/pics/background.png delete mode 100644 demos/declarative/samegame/SamegameCore/pics/blueStone.png delete mode 100644 demos/declarative/samegame/SamegameCore/pics/greenStone.png delete mode 100644 demos/declarative/samegame/SamegameCore/pics/particle.png delete mode 100644 demos/declarative/samegame/SamegameCore/pics/redStone.png delete mode 100644 demos/declarative/samegame/SamegameCore/pics/yellowStone.png delete mode 100644 demos/declarative/samegame/SamegameCore/qmldir delete mode 100755 demos/declarative/samegame/SamegameCore/samegame.js delete mode 100644 demos/declarative/samegame/highscores/README delete mode 100755 demos/declarative/samegame/highscores/score_data.xml delete mode 100755 demos/declarative/samegame/highscores/score_style.xsl delete mode 100755 demos/declarative/samegame/highscores/scores.php delete mode 100644 demos/declarative/samegame/samegame.qml delete mode 100644 demos/declarative/samegame/samegame.qmlproject delete mode 100644 demos/declarative/shadereffects/Slider.qml delete mode 100644 demos/declarative/shadereffects/face-smile.png delete mode 100644 demos/declarative/shadereffects/qt-logo.png delete mode 100644 demos/declarative/shadereffects/shader-demo.qml delete mode 100644 demos/declarative/snake/content/Button.qml delete mode 100644 demos/declarative/snake/content/Cookie.qml delete mode 100644 demos/declarative/snake/content/HighScoreModel.qml delete mode 100644 demos/declarative/snake/content/Link.qml delete mode 100644 demos/declarative/snake/content/Skull.qml delete mode 100644 demos/declarative/snake/content/pics/README delete mode 100644 demos/declarative/snake/content/pics/background.png delete mode 100644 demos/declarative/snake/content/pics/blueStar.png delete mode 100644 demos/declarative/snake/content/pics/blueStone.png delete mode 100644 demos/declarative/snake/content/pics/cookie.png delete mode 100644 demos/declarative/snake/content/pics/eyes.svg delete mode 100644 demos/declarative/snake/content/pics/head.png delete mode 100644 demos/declarative/snake/content/pics/head.svg delete mode 100644 demos/declarative/snake/content/pics/pause.png delete mode 100644 demos/declarative/snake/content/pics/redStar.png delete mode 100644 demos/declarative/snake/content/pics/redStone.png delete mode 100644 demos/declarative/snake/content/pics/skull.png delete mode 100644 demos/declarative/snake/content/pics/snake.jpg delete mode 100644 demos/declarative/snake/content/pics/star.png delete mode 100644 demos/declarative/snake/content/pics/stoneShadow.png delete mode 100644 demos/declarative/snake/content/pics/yellowStar.png delete mode 100644 demos/declarative/snake/content/pics/yellowStone.png delete mode 100644 demos/declarative/snake/content/snake.js delete mode 100644 demos/declarative/snake/snake.qml delete mode 100644 demos/declarative/snake/snake.qmlproject delete mode 100644 demos/declarative/twitter/TwitterCore/Button.qml delete mode 100644 demos/declarative/twitter/TwitterCore/FatDelegate.qml delete mode 100644 demos/declarative/twitter/TwitterCore/Input.qml delete mode 100644 demos/declarative/twitter/TwitterCore/Loading.qml delete mode 100644 demos/declarative/twitter/TwitterCore/MultiTitleBar.qml delete mode 100644 demos/declarative/twitter/TwitterCore/RssModel.qml delete mode 100644 demos/declarative/twitter/TwitterCore/SearchView.qml delete mode 100644 demos/declarative/twitter/TwitterCore/TitleBar.qml delete mode 100644 demos/declarative/twitter/TwitterCore/ToolBar.qml delete mode 100644 demos/declarative/twitter/TwitterCore/UserModel.qml delete mode 100644 demos/declarative/twitter/TwitterCore/images/gloss.png delete mode 100644 demos/declarative/twitter/TwitterCore/images/lineedit.png delete mode 100644 demos/declarative/twitter/TwitterCore/images/lineedit.sci delete mode 100644 demos/declarative/twitter/TwitterCore/images/loading.png delete mode 100644 demos/declarative/twitter/TwitterCore/images/quit.png delete mode 100644 demos/declarative/twitter/TwitterCore/images/stripes.png delete mode 100644 demos/declarative/twitter/TwitterCore/images/titlebar.png delete mode 100644 demos/declarative/twitter/TwitterCore/images/titlebar.sci delete mode 100644 demos/declarative/twitter/TwitterCore/images/toolbutton.png delete mode 100644 demos/declarative/twitter/TwitterCore/images/toolbutton.sci delete mode 100644 demos/declarative/twitter/TwitterCore/qmldir delete mode 100644 demos/declarative/twitter/twitter.qml delete mode 100644 demos/declarative/twitter/twitter.qmlproject delete mode 100644 demos/demos.pro delete mode 100644 demos/embedded/embedded.pro delete mode 100644 demos/embedded/qmlcalculator/deployment.pri delete mode 100644 demos/embedded/qmlcalculator/qmlcalculator.cpp delete mode 100644 demos/embedded/qmlcalculator/qmlcalculator.pro delete mode 100644 demos/embedded/qmlclocks/deployment.pri delete mode 100644 demos/embedded/qmlclocks/qmlclocks.cpp delete mode 100644 demos/embedded/qmlclocks/qmlclocks.pro delete mode 100644 demos/embedded/qmldialcontrol/deployment.pri delete mode 100644 demos/embedded/qmldialcontrol/qmldialcontrol.cpp delete mode 100644 demos/embedded/qmldialcontrol/qmldialcontrol.pro delete mode 100644 demos/embedded/qmleasing/deployment.pri delete mode 100644 demos/embedded/qmleasing/qmleasing.cpp delete mode 100644 demos/embedded/qmleasing/qmleasing.pro delete mode 100644 demos/embedded/qmlflickr/deployment.pri delete mode 100644 demos/embedded/qmlflickr/qmlflickr.cpp delete mode 100644 demos/embedded/qmlflickr/qmlflickr.pro delete mode 100644 demos/embedded/qmlphotoviewer/deployment.pri delete mode 100644 demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp delete mode 100644 demos/embedded/qmlphotoviewer/qmlphotoviewer.pro delete mode 100644 demos/embedded/qmltwitter/deployment.pri delete mode 100644 demos/embedded/qmltwitter/qmltwitter.cpp delete mode 100644 demos/embedded/qmltwitter/qmltwitter.pro create mode 100644 examples/declarative/calculator/Core/Button.qml create mode 100644 examples/declarative/calculator/Core/Display.qml create mode 100644 examples/declarative/calculator/Core/calculator.js create mode 100644 examples/declarative/calculator/Core/images/button-.png create mode 100644 examples/declarative/calculator/Core/images/button-blue.png create mode 100644 examples/declarative/calculator/Core/images/button-green.png create mode 100644 examples/declarative/calculator/Core/images/button-purple.png create mode 100644 examples/declarative/calculator/Core/images/button-red.png create mode 100644 examples/declarative/calculator/Core/images/display.png create mode 100644 examples/declarative/calculator/Core/qmldir create mode 100644 examples/declarative/calculator/calculator.qml create mode 100644 examples/declarative/calculator/calculator.qmlproject create mode 100644 examples/declarative/flickr/content/Button.qml create mode 100644 examples/declarative/flickr/content/GridDelegate.qml create mode 100644 examples/declarative/flickr/content/ImageDetails.qml create mode 100644 examples/declarative/flickr/content/ListDelegate.qml create mode 100644 examples/declarative/flickr/content/Progress.qml create mode 100644 examples/declarative/flickr/content/RssModel.qml create mode 100644 examples/declarative/flickr/content/ScrollBar.qml create mode 100644 examples/declarative/flickr/content/Slider.qml create mode 100644 examples/declarative/flickr/content/StreamView.qml create mode 100644 examples/declarative/flickr/content/TitleBar.qml create mode 100644 examples/declarative/flickr/content/ToolBar.qml create mode 100644 examples/declarative/flickr/content/UnifiedDelegate.qml create mode 100644 examples/declarative/flickr/content/images/gloss.png create mode 100644 examples/declarative/flickr/content/images/lineedit.png create mode 100644 examples/declarative/flickr/content/images/lineedit.sci create mode 100644 examples/declarative/flickr/content/images/noise.png create mode 100644 examples/declarative/flickr/content/images/particle.png create mode 100644 examples/declarative/flickr/content/images/quit.png create mode 100644 examples/declarative/flickr/content/images/squareParticle.png create mode 100644 examples/declarative/flickr/content/images/stripes.png create mode 100644 examples/declarative/flickr/content/images/titlebar.png create mode 100644 examples/declarative/flickr/content/images/titlebar.sci create mode 100644 examples/declarative/flickr/content/images/toolbutton.png create mode 100644 examples/declarative/flickr/content/images/toolbutton.sci create mode 100644 examples/declarative/flickr/content/qmldir create mode 100644 examples/declarative/flickr/flickr-90.qml create mode 100644 examples/declarative/flickr/flickr.qml create mode 100644 examples/declarative/flickr/flickr.qmlproject create mode 100644 examples/declarative/minehunt/MinehuntCore/Explosion.qml create mode 100644 examples/declarative/minehunt/MinehuntCore/Tile.qml create mode 100644 examples/declarative/minehunt/MinehuntCore/pics/back.png create mode 100644 examples/declarative/minehunt/MinehuntCore/pics/background.png create mode 100644 examples/declarative/minehunt/MinehuntCore/pics/bomb-color.png create mode 100644 examples/declarative/minehunt/MinehuntCore/pics/bomb.png create mode 100644 examples/declarative/minehunt/MinehuntCore/pics/face-sad.png create mode 100644 examples/declarative/minehunt/MinehuntCore/pics/face-smile-big.png create mode 100644 examples/declarative/minehunt/MinehuntCore/pics/face-smile.png create mode 100644 examples/declarative/minehunt/MinehuntCore/pics/flag-color.png create mode 100644 examples/declarative/minehunt/MinehuntCore/pics/flag.png create mode 100644 examples/declarative/minehunt/MinehuntCore/pics/front.png create mode 100644 examples/declarative/minehunt/MinehuntCore/pics/quit.png create mode 100644 examples/declarative/minehunt/MinehuntCore/pics/star.png create mode 100644 examples/declarative/minehunt/MinehuntCore/qmldir 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.qml create mode 100644 examples/declarative/minehunt/minehunt.qmlproject create mode 100644 examples/declarative/minehunt/minehunt.qrc create mode 100644 examples/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml create mode 100644 examples/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml create mode 100644 examples/declarative/photoviewer/PhotoViewerCore/Button.qml create mode 100644 examples/declarative/photoviewer/PhotoViewerCore/EditableButton.qml create mode 100644 examples/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml create mode 100644 examples/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml create mode 100644 examples/declarative/photoviewer/PhotoViewerCore/RssModel.qml create mode 100644 examples/declarative/photoviewer/PhotoViewerCore/Tag.qml create mode 100644 examples/declarative/photoviewer/PhotoViewerCore/images/box-shadow.png create mode 100644 examples/declarative/photoviewer/PhotoViewerCore/images/busy.png create mode 100644 examples/declarative/photoviewer/PhotoViewerCore/images/cardboard.png create mode 100644 examples/declarative/photoviewer/PhotoViewerCore/qmldir create mode 100644 examples/declarative/photoviewer/PhotoViewerCore/script/script.js create mode 100644 examples/declarative/photoviewer/i18n/base.ts create mode 100644 examples/declarative/photoviewer/i18n/qml_fr.qm create mode 100644 examples/declarative/photoviewer/i18n/qml_fr.ts create mode 100644 examples/declarative/photoviewer/photoviewer.qml create mode 100644 examples/declarative/photoviewer/photoviewer.qmlproject create mode 100644 examples/declarative/plasmapatrol/PlasmaPatrol.qmlproject create mode 100644 examples/declarative/plasmapatrol/TODO create mode 100644 examples/declarative/plasmapatrol/content/BlasterHardpoint.qml create mode 100644 examples/declarative/plasmapatrol/content/Button.qml create mode 100644 examples/declarative/plasmapatrol/content/CannonHardpoint.qml create mode 100644 examples/declarative/plasmapatrol/content/ChoiceBox.qml create mode 100644 examples/declarative/plasmapatrol/content/Cruiser.qml create mode 100644 examples/declarative/plasmapatrol/content/Frigate.qml create mode 100644 examples/declarative/plasmapatrol/content/Hardpoint.qml create mode 100644 examples/declarative/plasmapatrol/content/HelpScreens.qml create mode 100644 examples/declarative/plasmapatrol/content/LaserHardpoint.qml create mode 100644 examples/declarative/plasmapatrol/content/PlasmaPatrolParticles.qml create mode 100644 examples/declarative/plasmapatrol/content/SequentialLoader.qml create mode 100644 examples/declarative/plasmapatrol/content/Ship.qml create mode 100644 examples/declarative/plasmapatrol/content/Sloop.qml create mode 100644 examples/declarative/plasmapatrol/content/pics/TitleText.png create mode 100644 examples/declarative/plasmapatrol/content/pics/blur-circle2.png create mode 100644 examples/declarative/plasmapatrol/content/pics/blur-circle3.png create mode 100644 examples/declarative/plasmapatrol/content/pics/finalfrontier.png create mode 100644 examples/declarative/plasmapatrol/content/pics/meteor.png create mode 100644 examples/declarative/plasmapatrol/content/pics/meteor_explo.png create mode 100644 examples/declarative/plasmapatrol/content/pics/nullRock.png create mode 100644 examples/declarative/plasmapatrol/content/pics/particle.png create mode 100644 examples/declarative/plasmapatrol/content/pics/star.png create mode 100644 examples/declarative/plasmapatrol/content/pics/star2.png create mode 100644 examples/declarative/plasmapatrol/content/pics/star3.png create mode 100644 examples/declarative/plasmapatrol/plasmapatrol.qml create mode 100644 examples/declarative/rssnews/content/BusyIndicator.qml create mode 100644 examples/declarative/rssnews/content/CategoryDelegate.qml create mode 100644 examples/declarative/rssnews/content/NewsDelegate.qml create mode 100644 examples/declarative/rssnews/content/RssFeeds.qml create mode 100644 examples/declarative/rssnews/content/ScrollBar.qml create mode 100644 examples/declarative/rssnews/content/images/busy.png create mode 100644 examples/declarative/rssnews/content/images/scrollbar.png create mode 100644 examples/declarative/rssnews/rssnews.qml create mode 100644 examples/declarative/rssnews/rssnews.qmlproject create mode 100644 examples/declarative/samegame/SamegameCore/BoomBlock.qml create mode 100644 examples/declarative/samegame/SamegameCore/Button.qml create mode 100644 examples/declarative/samegame/SamegameCore/Dialog.qml create mode 100644 examples/declarative/samegame/SamegameCore/pics/background.png create mode 100644 examples/declarative/samegame/SamegameCore/pics/blueStone.png create mode 100644 examples/declarative/samegame/SamegameCore/pics/greenStone.png create mode 100644 examples/declarative/samegame/SamegameCore/pics/particle.png create mode 100644 examples/declarative/samegame/SamegameCore/pics/redStone.png create mode 100644 examples/declarative/samegame/SamegameCore/pics/yellowStone.png create mode 100644 examples/declarative/samegame/SamegameCore/qmldir create mode 100755 examples/declarative/samegame/SamegameCore/samegame.js create mode 100644 examples/declarative/samegame/highscores/README create mode 100755 examples/declarative/samegame/highscores/score_data.xml create mode 100755 examples/declarative/samegame/highscores/score_style.xsl create mode 100755 examples/declarative/samegame/highscores/scores.php create mode 100644 examples/declarative/samegame/samegame.qml create mode 100644 examples/declarative/samegame/samegame.qmlproject create mode 100644 examples/declarative/shadereffects/Slider.qml create mode 100644 examples/declarative/shadereffects/face-smile.png create mode 100644 examples/declarative/shadereffects/qt-logo.png create mode 100644 examples/declarative/shadereffects/shader-demo.qml create mode 100644 examples/declarative/snake/content/Button.qml create mode 100644 examples/declarative/snake/content/Cookie.qml create mode 100644 examples/declarative/snake/content/HighScoreModel.qml create mode 100644 examples/declarative/snake/content/Link.qml create mode 100644 examples/declarative/snake/content/Skull.qml create mode 100644 examples/declarative/snake/content/pics/README create mode 100644 examples/declarative/snake/content/pics/background.png create mode 100644 examples/declarative/snake/content/pics/blueStar.png create mode 100644 examples/declarative/snake/content/pics/blueStone.png create mode 100644 examples/declarative/snake/content/pics/cookie.png create mode 100644 examples/declarative/snake/content/pics/eyes.svg create mode 100644 examples/declarative/snake/content/pics/head.png create mode 100644 examples/declarative/snake/content/pics/head.svg create mode 100644 examples/declarative/snake/content/pics/pause.png create mode 100644 examples/declarative/snake/content/pics/redStar.png create mode 100644 examples/declarative/snake/content/pics/redStone.png create mode 100644 examples/declarative/snake/content/pics/skull.png create mode 100644 examples/declarative/snake/content/pics/snake.jpg create mode 100644 examples/declarative/snake/content/pics/star.png create mode 100644 examples/declarative/snake/content/pics/stoneShadow.png create mode 100644 examples/declarative/snake/content/pics/yellowStar.png create mode 100644 examples/declarative/snake/content/pics/yellowStone.png create mode 100644 examples/declarative/snake/content/snake.js create mode 100644 examples/declarative/snake/snake.qml create mode 100644 examples/declarative/snake/snake.qmlproject create mode 100644 examples/declarative/twitter/TwitterCore/Button.qml create mode 100644 examples/declarative/twitter/TwitterCore/FatDelegate.qml create mode 100644 examples/declarative/twitter/TwitterCore/Input.qml create mode 100644 examples/declarative/twitter/TwitterCore/Loading.qml create mode 100644 examples/declarative/twitter/TwitterCore/MultiTitleBar.qml create mode 100644 examples/declarative/twitter/TwitterCore/RssModel.qml create mode 100644 examples/declarative/twitter/TwitterCore/SearchView.qml create mode 100644 examples/declarative/twitter/TwitterCore/TitleBar.qml create mode 100644 examples/declarative/twitter/TwitterCore/ToolBar.qml create mode 100644 examples/declarative/twitter/TwitterCore/UserModel.qml create mode 100644 examples/declarative/twitter/TwitterCore/images/gloss.png create mode 100644 examples/declarative/twitter/TwitterCore/images/lineedit.png create mode 100644 examples/declarative/twitter/TwitterCore/images/lineedit.sci create mode 100644 examples/declarative/twitter/TwitterCore/images/loading.png create mode 100644 examples/declarative/twitter/TwitterCore/images/quit.png create mode 100644 examples/declarative/twitter/TwitterCore/images/stripes.png create mode 100644 examples/declarative/twitter/TwitterCore/images/titlebar.png create mode 100644 examples/declarative/twitter/TwitterCore/images/titlebar.sci create mode 100644 examples/declarative/twitter/TwitterCore/images/toolbutton.png create mode 100644 examples/declarative/twitter/TwitterCore/images/toolbutton.sci create mode 100644 examples/declarative/twitter/TwitterCore/qmldir create mode 100644 examples/declarative/twitter/twitter.qml create mode 100644 examples/declarative/twitter/twitter.qmlproject create mode 100644 examples/embedded/embedded.pro create mode 100644 examples/embedded/qmlcalculator/deployment.pri create mode 100644 examples/embedded/qmlcalculator/qmlcalculator.cpp create mode 100644 examples/embedded/qmlcalculator/qmlcalculator.pro create mode 100644 examples/embedded/qmlclocks/deployment.pri create mode 100644 examples/embedded/qmlclocks/qmlclocks.cpp create mode 100644 examples/embedded/qmlclocks/qmlclocks.pro create mode 100644 examples/embedded/qmldialcontrol/deployment.pri create mode 100644 examples/embedded/qmldialcontrol/qmldialcontrol.cpp create mode 100644 examples/embedded/qmldialcontrol/qmldialcontrol.pro create mode 100644 examples/embedded/qmleasing/deployment.pri create mode 100644 examples/embedded/qmleasing/qmleasing.cpp create mode 100644 examples/embedded/qmleasing/qmleasing.pro create mode 100644 examples/embedded/qmlflickr/deployment.pri create mode 100644 examples/embedded/qmlflickr/qmlflickr.cpp create mode 100644 examples/embedded/qmlflickr/qmlflickr.pro create mode 100644 examples/embedded/qmlphotoviewer/deployment.pri create mode 100644 examples/embedded/qmlphotoviewer/qmlphotoviewer.cpp create mode 100644 examples/embedded/qmlphotoviewer/qmlphotoviewer.pro create mode 100644 examples/embedded/qmltwitter/deployment.pri create mode 100644 examples/embedded/qmltwitter/qmltwitter.cpp create mode 100644 examples/embedded/qmltwitter/qmltwitter.pro diff --git a/demos/declarative/calculator/Core/Button.qml b/demos/declarative/calculator/Core/Button.qml deleted file mode 100644 index c5ec39cea8..0000000000 --- a/demos/declarative/calculator/Core/Button.qml +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/calculator/Core/Display.qml b/demos/declarative/calculator/Core/Display.qml deleted file mode 100644 index 5e27897bae..0000000000 --- a/demos/declarative/calculator/Core/Display.qml +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/calculator/Core/calculator.js b/demos/declarative/calculator/Core/calculator.js deleted file mode 100644 index 7c363c7f30..0000000000 --- a/demos/declarative/calculator/Core/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/demos/declarative/calculator/Core/images/button-.png b/demos/declarative/calculator/Core/images/button-.png deleted file mode 100644 index 544e514536..0000000000 Binary files a/demos/declarative/calculator/Core/images/button-.png and /dev/null differ diff --git a/demos/declarative/calculator/Core/images/button-blue.png b/demos/declarative/calculator/Core/images/button-blue.png deleted file mode 100644 index 5f92de32d0..0000000000 Binary files a/demos/declarative/calculator/Core/images/button-blue.png and /dev/null differ diff --git a/demos/declarative/calculator/Core/images/button-green.png b/demos/declarative/calculator/Core/images/button-green.png deleted file mode 100644 index 36c93914c7..0000000000 Binary files a/demos/declarative/calculator/Core/images/button-green.png and /dev/null differ diff --git a/demos/declarative/calculator/Core/images/button-purple.png b/demos/declarative/calculator/Core/images/button-purple.png deleted file mode 100644 index 347cbbea9d..0000000000 Binary files a/demos/declarative/calculator/Core/images/button-purple.png and /dev/null differ diff --git a/demos/declarative/calculator/Core/images/button-red.png b/demos/declarative/calculator/Core/images/button-red.png deleted file mode 100644 index 3b335891ae..0000000000 Binary files a/demos/declarative/calculator/Core/images/button-red.png and /dev/null differ diff --git a/demos/declarative/calculator/Core/images/display.png b/demos/declarative/calculator/Core/images/display.png deleted file mode 100644 index 9507f4382e..0000000000 Binary files a/demos/declarative/calculator/Core/images/display.png and /dev/null differ diff --git a/demos/declarative/calculator/Core/qmldir b/demos/declarative/calculator/Core/qmldir deleted file mode 100644 index a926b93fac..0000000000 --- a/demos/declarative/calculator/Core/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -Button Button.qml -Display Display.qml diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml deleted file mode 100644 index c844c710aa..0000000000 --- a/demos/declarative/calculator/calculator.qml +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 -import "Core" -import "Core/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/demos/declarative/calculator/calculator.qmlproject b/demos/declarative/calculator/calculator.qmlproject deleted file mode 100644 index d4909f8685..0000000000 --- a/demos/declarative/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: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/demos/declarative/declarative.pro b/demos/declarative/declarative.pro deleted file mode 100644 index 561832c347..0000000000 --- a/demos/declarative/declarative.pro +++ /dev/null @@ -1,20 +0,0 @@ -TEMPLATE = subdirs - -# These demos contain C++ and need to be compiled -SUBDIRS = \ - minehunt - -# These examples contain no C++ and can simply be copied -sources.files = \ - calculator \ - flickr \ - photoviewer \ - samegame \ - snake \ - twitter \ - rssnews \ - webbrowser - -sources.path = $$[QT_INSTALL_DEMOS]/qtdeclarative/declarative -INSTALLS += sources - diff --git a/demos/declarative/demos.qmlproject b/demos/declarative/demos.qmlproject deleted file mode 100644 index d4909f8685..0000000000 --- a/demos/declarative/demos.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/demos/declarative/flickr/content/Button.qml b/demos/declarative/flickr/content/Button.qml deleted file mode 100644 index 7285753a0a..0000000000 --- a/demos/declarative/flickr/content/Button.qml +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.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/demos/declarative/flickr/content/GridDelegate.qml b/demos/declarative/flickr/content/GridDelegate.qml deleted file mode 100644 index 5b7af23ea0..0000000000 --- a/demos/declarative/flickr/content/GridDelegate.qml +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.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/demos/declarative/flickr/content/ImageDetails.qml b/demos/declarative/flickr/content/ImageDetails.qml deleted file mode 100644 index 74346466e3..0000000000 --- a/demos/declarative/flickr/content/ImageDetails.qml +++ /dev/null @@ -1,355 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -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 - - property int flipDuration: 1600 - - 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 } - - 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; - } - if (inBackState && bigImage.status == Image.Ready) - effectBox.imageInAnim(); - } - property bool inBackState: false - onInBackStateChanged:{ - if(inBackState && bigImage.status == Image.Ready) - effectBox.imageInAnim(); - else if (!inBackState && bigImage.status == Image.Ready) - effectBox.imageOutAnim(); - } - } - ShaderEffectSource{ - id: pictureSource - sourceItem: bigImage - smooth: true - //Workaround: Doesn't work below lines - width: bigImage.width - height: bigImage.width - visible: false - } - Turbulence{//only fill visible rect - id: turbulence - system: imageSystem - anchors.fill: parent - frequency: 100 - strength: 250 - active: false - } - - Item{ - id: effectBox - width: bigImage.width * bigImage.scale - height: bigImage.height * bigImage.scale - anchors.centerIn: parent - function imageInAnim(){ - bigImage.visible = false; - noiseIn.visible = true; - endEffectTimer.start(); - } - function imageOutAnim(){ - bigImage.visible = false; - noiseIn.visible = false; - turbulence.active = true; - endEffectTimer.start(); - pixelEmitter.burst(2048); - } - Timer{ - id: endEffectTimer - interval: flipDuration - repeat: false - running: false - onTriggered:{ - turbulence.active = false; - noiseIn.visible = false; - bigImage.visible = true; - } - } - ShaderEffectItem{ - id: noiseIn - anchors.fill: parent - property real t: 0 - visible: false - onVisibleChanged: tAnim.start() - NumberAnimation{ - id: tAnim - target: noiseIn - property: "t" - from: 0.0 - to: 1.0 - duration: flipDuration - } - property variant source: pictureSource - property variant noise: ShaderEffectSource{ - sourceItem:Image{ - source: "images/noise.png" - } - hideSource: true - smooth: false - } - fragmentShader:" - uniform sampler2D noise; - uniform sampler2D source; - uniform highp float t; - uniform lowp float qt_Opacity; - varying highp vec2 qt_TexCoord0; - void main(){ - //Want to use noise2, but it always returns (0,0)? - if(texture2D(noise, qt_TexCoord0).w <= t) - gl_FragColor = texture2D(source, qt_TexCoord0) * qt_Opacity; - else - gl_FragColor = vec4(0.,0.,0.,0.); - } - " - } - ParticleSystem{ - id: imageSystem - } - Emitter{ - id: pixelEmitter - system: imageSystem - //anchors.fill: parent - width: Math.min(bigImage.width * bigImage.scale, flickable.width); - height: Math.min(bigImage.height * bigImage.scale, flickable.height); - anchors.centerIn: parent - size: 4 - lifeSpan: flipDuration - emitRate: 2048 - emitting: false - } - CustomParticle{ - id: blowOut - system: imageSystem - property real maxWidth: effectBox.width - property real maxHeight: effectBox.height - vertexShader:" - attribute highp vec2 vPos; - attribute highp vec2 vTex; - attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize - attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration - attribute highp float r; - - uniform highp float maxWidth; - uniform highp float maxHeight; - - uniform highp mat4 qt_ModelViewProjectionMatrix; - uniform highp float timestamp; - uniform lowp float qt_Opacity; - - varying highp vec2 fTex2; - varying lowp float fFade; - - void main() { - fTex2 = vec2(vPos.x / maxWidth, vPos.y / maxHeight); - highp float size = vData.z; - highp float endSize = vData.w; - - highp float t = (timestamp - vData.x) / vData.y; - - highp float currentSize = mix(size, endSize, t * t); - - if (t < 0. || t > 1.) - currentSize = 0.; - - highp vec2 pos = vPos - - currentSize / 2. + currentSize * vTex // adjust size - + vVec.xy * t * vData.y // apply speed vector.. - + 0.5 * vVec.zw * pow(t * vData.y, 2.); - - gl_Position = qt_ModelViewProjectionMatrix * vec4(pos.x, pos.y, 0, 1); - - highp float fadeIn = min(t * 10., 1.); - highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.)); - - fFade = 1.0;//fadeIn * fadeOut * qt_Opacity; - } - " - property variant pictureTexture: pictureSource - fragmentShader: " - uniform sampler2D pictureTexture; - varying highp vec2 fTex2; - varying highp float fFade; - void main() { - gl_FragColor = texture2D(pictureTexture, fTex2) * fFade; - }" - } - - - - } - } - } - - Text { - text: "Image Unavailable" - visible: bigImage.status == Image.Error - anchors.centerIn: parent; color: "white"; font.bold: true - } - - 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" } - PropertyChanges { target: bigImage; inBackState: true } - } - - transitions: Transition { - SequentialAnimation { - PropertyAction { target: bigImage; property: "smooth"; value: false } - NumberAnimation { easing.type: Easing.InOutQuad; properties: "angle"; duration: flipDuration } - PropertyAction { target: bigImage; property: "smooth"; value: !flickable.movingVertically } - } - } -} diff --git a/demos/declarative/flickr/content/ListDelegate.qml b/demos/declarative/flickr/content/ListDelegate.qml deleted file mode 100644 index b65704867b..0000000000 --- a/demos/declarative/flickr/content/ListDelegate.qml +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.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/demos/declarative/flickr/content/Progress.qml b/demos/declarative/flickr/content/Progress.qml deleted file mode 100644 index 73a91a4aa9..0000000000 --- a/demos/declarative/flickr/content/Progress.qml +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item{ - id: container - 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" } - } - } - - ParticleSystem{ - running: container.visible - id: barSys - } - ImageParticle{ - color: "lightsteelblue" - alpha: 0.1 - colorVariation: 0.05 - source: "images/particle.png" - system: barSys - } - Emitter{ - y: 2; height: parent.height-4; - x: 2; width: Math.max(parent.width * progress - 4, 0); - speed: AngledDirection{ angleVariation: 180; magnitudeVariation: 12 } - system: barSys - emitRate: width; - lifeSpan: 1000 - size: 20 - sizeVariation: 4 - endSize: 12 - emitCap: parent.width; - } - - Text { - text: Math.round(progress * 100) + "%" - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - color: Qt.rgba(1.0, 1.0 - progress, 1.0 - progress,0.9); font.bold: true; font.pixelSize: 15 - } -} diff --git a/demos/declarative/flickr/content/RssModel.qml b/demos/declarative/flickr/content/RssModel.qml deleted file mode 100644 index 007f086830..0000000000 --- a/demos/declarative/flickr/content/RssModel.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.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/demos/declarative/flickr/content/ScrollBar.qml b/demos/declarative/flickr/content/ScrollBar.qml deleted file mode 100644 index 7d2d9ff7d3..0000000000 --- a/demos/declarative/flickr/content/ScrollBar.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.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/demos/declarative/flickr/content/Slider.qml b/demos/declarative/flickr/content/Slider.qml deleted file mode 100644 index b4a2960ac8..0000000000 --- a/demos/declarative/flickr/content/Slider.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.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/demos/declarative/flickr/content/StreamView.qml b/demos/declarative/flickr/content/StreamView.qml deleted file mode 100644 index e2c65e22fe..0000000000 --- a/demos/declarative/flickr/content/StreamView.qml +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item{ - id: container - property alias model: mp.model - property alias delegate: mp.delegate - property bool jumpStarted: false - ParticleSystem{ - id: sys - anchors.fill:parent - } - ModelParticle{ - id: mp - fade: false - system: sys - anchors.fill: parent - onModelCountChanged: { - if(!jumpStarted && modelCount > 0){ - console.log("Jumping"); - jumpStarted = true; - sys.fastForward(8000); - } - } - } - property real emitterSpacing: parent.width/3 - Emitter{ - system: sys - width: emitterSpacing - 64 - x: emitterSpacing*0 + 32 - y: -128 - height: 32 - speed: PointDirection{ y: (container.height + 128)/12 } - emitRate: 0.4 - lifeSpan: 1000000//eventually -1 should mean a million seconds for neatness - emitCap: 15 - } - Emitter{ - system: sys - width: emitterSpacing - 64 - x: emitterSpacing*1 + 32 - y: -128 - height: 32 - speed: PointDirection{ y: (container.height + 128)/12 } - emitRate: 0.4 - lifeSpan: 1000000//eventually -1 should mean a million seconds for neatness - emitCap: 15 - } - Emitter{ - system: sys - width: emitterSpacing - 64 - x: emitterSpacing*2 + 32 - y: -128 - height: 32 - speed: PointDirection{ y: (container.height + 128)/12 } - emitRate: 0.4 - lifeSpan: 1000000//eventually -1 should mean a million seconds for neatness - emitCap: 15 - } - Kill{ - system: sys - y: container.height + 64 - width: container.width - height: 6400 - } -} diff --git a/demos/declarative/flickr/content/TitleBar.qml b/demos/declarative/flickr/content/TitleBar.qml deleted file mode 100644 index 381d252ed3..0000000000 --- a/demos/declarative/flickr/content/TitleBar.qml +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.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/demos/declarative/flickr/content/ToolBar.qml b/demos/declarative/flickr/content/ToolBar.qml deleted file mode 100644 index ca5341e101..0000000000 --- a/demos/declarative/flickr/content/ToolBar.qml +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.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/demos/declarative/flickr/content/UnifiedDelegate.qml b/demos/declarative/flickr/content/UnifiedDelegate.qml deleted file mode 100644 index f4c926763f..0000000000 --- a/demos/declarative/flickr/content/UnifiedDelegate.qml +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Package { - 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 { - id: gridwrapper; - width: GridView.view.cellWidth; height: GridView.view.cellHeight - Package.name: "grid" - } - Item { - id: streamwrapper; - width: 80; height: 80 - Package.name: "stream" - function pleaseFreeze(){ - ModelParticle.particle.freeze(streamwrapper); - } - function pleaseUnfreeze(){ - ModelParticle.particle.unfreeze(streamwrapper); - } - } - Item { - //anchors.centerIn: parent//Doesn't animate :( - width: 80; height: 80 - scale: 0.0 - Behavior on scale { NumberAnimation { easing.type: Easing.InOutQuad} } - id: scaleMe - - Item { - id: whiteRectContainer - width: 77; height: 77; anchors.centerIn: parent - Rectangle { - id: whiteRect; width: 77; height: 77; color: "#dddddd"; smooth: true - x:0; y:0 - Image { id: thumb; source: imagePath; x: 1; y: 1; smooth: true } - Image { source: "images/gloss.png" } - MouseArea { anchors.fill: parent; onClicked: photoClicked() } - } - } - - Connections { - target: toolBar - onButton2Clicked: if (scaleMe.state == 'Details' ) scaleMe.state = 'Show' - } - - state: 'inStream' - 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" - ScriptAction{ script: streamwrapper.pleaseFreeze(); } - ParentAnimation { - via: foreground - NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } - } - }, - Transition { - from: "Details"; to: "Show" - SequentialAnimation{ - ParentAnimation { - via: foreground - NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } - } - ScriptAction{ script: streamwrapper.pleaseUnfreeze(); } - } - } - ] - Item{ - id: stateContainer - states: [ - State { - name: 'inStream' - when: screen.inGridView == false - ParentChange { - target: scaleMe; parent: streamwrapper - x: 0; y: 0; - } - }, - State { - name: 'inGrid' - when: screen.inGridView == true - ParentChange { - target: scaleMe; parent: gridwrapper - x: 0; y: 0; - } - } - ] - - transitions: [ - Transition { - ParentAnimation { - NumberAnimation { target: scaleMe; properties: 'x,y,width,height'; duration: 300 } - } - } - ] - } - } -} diff --git a/demos/declarative/flickr/content/images/gloss.png b/demos/declarative/flickr/content/images/gloss.png deleted file mode 100644 index 5d370cd93d..0000000000 Binary files a/demos/declarative/flickr/content/images/gloss.png and /dev/null differ diff --git a/demos/declarative/flickr/content/images/lineedit.png b/demos/declarative/flickr/content/images/lineedit.png deleted file mode 100644 index 2cc38dc35b..0000000000 Binary files a/demos/declarative/flickr/content/images/lineedit.png and /dev/null differ diff --git a/demos/declarative/flickr/content/images/lineedit.sci b/demos/declarative/flickr/content/images/lineedit.sci deleted file mode 100644 index 054bff78be..0000000000 --- a/demos/declarative/flickr/content/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/demos/declarative/flickr/content/images/noise.png b/demos/declarative/flickr/content/images/noise.png deleted file mode 100644 index c5a5ba0053..0000000000 Binary files a/demos/declarative/flickr/content/images/noise.png and /dev/null differ diff --git a/demos/declarative/flickr/content/images/particle.png b/demos/declarative/flickr/content/images/particle.png deleted file mode 100644 index dbc39cb16e..0000000000 Binary files a/demos/declarative/flickr/content/images/particle.png and /dev/null differ diff --git a/demos/declarative/flickr/content/images/quit.png b/demos/declarative/flickr/content/images/quit.png deleted file mode 100644 index 5bda1b6e0d..0000000000 Binary files a/demos/declarative/flickr/content/images/quit.png and /dev/null differ diff --git a/demos/declarative/flickr/content/images/squareParticle.png b/demos/declarative/flickr/content/images/squareParticle.png deleted file mode 100644 index faf85c24e0..0000000000 Binary files a/demos/declarative/flickr/content/images/squareParticle.png and /dev/null differ diff --git a/demos/declarative/flickr/content/images/stripes.png b/demos/declarative/flickr/content/images/stripes.png deleted file mode 100644 index 9f36727ea4..0000000000 Binary files a/demos/declarative/flickr/content/images/stripes.png and /dev/null differ diff --git a/demos/declarative/flickr/content/images/titlebar.png b/demos/declarative/flickr/content/images/titlebar.png deleted file mode 100644 index 51c90082d0..0000000000 Binary files a/demos/declarative/flickr/content/images/titlebar.png and /dev/null differ diff --git a/demos/declarative/flickr/content/images/titlebar.sci b/demos/declarative/flickr/content/images/titlebar.sci deleted file mode 100644 index 0418d94cd6..0000000000 --- a/demos/declarative/flickr/content/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/demos/declarative/flickr/content/images/toolbutton.png b/demos/declarative/flickr/content/images/toolbutton.png deleted file mode 100644 index 11310013ee..0000000000 Binary files a/demos/declarative/flickr/content/images/toolbutton.png and /dev/null differ diff --git a/demos/declarative/flickr/content/images/toolbutton.sci b/demos/declarative/flickr/content/images/toolbutton.sci deleted file mode 100644 index 9e4f965307..0000000000 --- a/demos/declarative/flickr/content/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/demos/declarative/flickr/content/qmldir b/demos/declarative/flickr/content/qmldir deleted file mode 100644 index adc2479b9f..0000000000 --- a/demos/declarative/flickr/content/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/demos/declarative/flickr/flickr-90.qml b/demos/declarative/flickr/flickr-90.qml deleted file mode 100644 index ce22d8a3a9..0000000000 --- a/demos/declarative/flickr/flickr-90.qml +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - width: 480; height: 320 - - Loader { - y: 320; rotation: -90 - transformOrigin: Item.TopLeft - source: "flickr.qml" - } -} diff --git a/demos/declarative/flickr/flickr.qml b/demos/declarative/flickr/flickr.qml deleted file mode 100644 index a222b41341..0000000000 --- a/demos/declarative/flickr/flickr.qml +++ /dev/null @@ -1,166 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 -import "content" - -Item { - id: screen; width: 320; height: 480 - property bool inGridView : false - - Rectangle { - id: background - anchors.fill: parent; color: "#343434"; - - Image { source: "content/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } - ParticleSystem { - id: bgParticles - startTime: 16000 - } - ImageParticle { - particles: ["trail"] - source: "content/images/particle.png" - color: "#1A1A6F" - alpha: 0.1 - colorVariation: 0.01 - blueVariation: 0.8 - system: bgParticles - } - Emitter { - particle: "drops" - width: parent.width - emitRate: 0.5 - lifeSpan: 20000 - speed: PointDirection{ - y: {screen.height/18} - } - system: bgParticles - } - FollowEmitter { - follow: "drops" - particle: "trail" - emitRatePerParticle: 18 - size: 32 - endSize: 0 - sizeVariation: 4 - lifeSpan: 1200 - system: bgParticles - anchors.fill: parent - emitWidth: 16 - emitHeight: 16 - emitShape: EllipseShape{} - } - - VisualDataModel{ - id: vdm - delegate: UnifiedDelegate{} - model: RssModel { id: rssModel } - } - - Item { - id: views - width: parent.width - anchors.top: titleBar.bottom; anchors.bottom: toolBar.top - - GridView { - id: photoGridView; model: vdm.parts.grid - cacheBuffer: 1000 - cellWidth: (parent.width-2)/4; cellHeight: cellWidth; width: parent.width; height: parent.height - } - - StreamView{ - id: photoStreamView - model: vdm.parts.stream - width: parent.width; height: parent.height - } - - states: State { - name: "GridView"; when: screen.inGridView == true - } - - transitions: Transition { - NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad } - } - - ImageDetails { id: imageDetails; width: parent.width; anchors.left: views.right; height: parent.height } - - Item { id: foreground; anchors.fill: parent } - } - - TitleBar { id: titleBar; width: parent.width; height: 40; opacity: 0.9 } - - 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.inGridView == true) screen.inGridView = false; else screen.inGridView = 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/demos/declarative/flickr/flickr.qmlproject b/demos/declarative/flickr/flickr.qmlproject deleted file mode 100644 index d4909f8685..0000000000 --- a/demos/declarative/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: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/demos/declarative/minehunt/MinehuntCore/Explosion.qml b/demos/declarative/minehunt/MinehuntCore/Explosion.qml deleted file mode 100644 index a5f3f1bc31..0000000000 --- a/demos/declarative/minehunt/MinehuntCore/Explosion.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/minehunt/MinehuntCore/Tile.qml b/demos/declarative/minehunt/MinehuntCore/Tile.qml deleted file mode 100644 index 90247f8575..0000000000 --- a/demos/declarative/minehunt/MinehuntCore/Tile.qml +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/minehunt/MinehuntCore/pics/back.png b/demos/declarative/minehunt/MinehuntCore/pics/back.png deleted file mode 100644 index f6b3f0b4d7..0000000000 Binary files a/demos/declarative/minehunt/MinehuntCore/pics/back.png and /dev/null differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/background.png b/demos/declarative/minehunt/MinehuntCore/pics/background.png deleted file mode 100644 index 3734a27744..0000000000 Binary files a/demos/declarative/minehunt/MinehuntCore/pics/background.png and /dev/null differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/bomb-color.png b/demos/declarative/minehunt/MinehuntCore/pics/bomb-color.png deleted file mode 100644 index 61ad0a928f..0000000000 Binary files a/demos/declarative/minehunt/MinehuntCore/pics/bomb-color.png and /dev/null differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/bomb.png b/demos/declarative/minehunt/MinehuntCore/pics/bomb.png deleted file mode 100644 index a992575518..0000000000 Binary files a/demos/declarative/minehunt/MinehuntCore/pics/bomb.png and /dev/null differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/face-sad.png b/demos/declarative/minehunt/MinehuntCore/pics/face-sad.png deleted file mode 100644 index cf00aafe1f..0000000000 Binary files a/demos/declarative/minehunt/MinehuntCore/pics/face-sad.png and /dev/null differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/face-smile-big.png b/demos/declarative/minehunt/MinehuntCore/pics/face-smile-big.png deleted file mode 100644 index f9c2335df5..0000000000 Binary files a/demos/declarative/minehunt/MinehuntCore/pics/face-smile-big.png and /dev/null differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/face-smile.png b/demos/declarative/minehunt/MinehuntCore/pics/face-smile.png deleted file mode 100644 index 3d66d72578..0000000000 Binary files a/demos/declarative/minehunt/MinehuntCore/pics/face-smile.png and /dev/null differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/flag-color.png b/demos/declarative/minehunt/MinehuntCore/pics/flag-color.png deleted file mode 100644 index aadad0f11a..0000000000 Binary files a/demos/declarative/minehunt/MinehuntCore/pics/flag-color.png and /dev/null differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/flag.png b/demos/declarative/minehunt/MinehuntCore/pics/flag.png deleted file mode 100644 index 39cde4df82..0000000000 Binary files a/demos/declarative/minehunt/MinehuntCore/pics/flag.png and /dev/null differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/front.png b/demos/declarative/minehunt/MinehuntCore/pics/front.png deleted file mode 100644 index 834331bd49..0000000000 Binary files a/demos/declarative/minehunt/MinehuntCore/pics/front.png and /dev/null differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/quit.png b/demos/declarative/minehunt/MinehuntCore/pics/quit.png deleted file mode 100644 index b822057d4e..0000000000 Binary files a/demos/declarative/minehunt/MinehuntCore/pics/quit.png and /dev/null differ diff --git a/demos/declarative/minehunt/MinehuntCore/pics/star.png b/demos/declarative/minehunt/MinehuntCore/pics/star.png deleted file mode 100644 index 3772359188..0000000000 Binary files a/demos/declarative/minehunt/MinehuntCore/pics/star.png and /dev/null differ diff --git a/demos/declarative/minehunt/MinehuntCore/qmldir b/demos/declarative/minehunt/MinehuntCore/qmldir deleted file mode 100644 index 81980e09a6..0000000000 --- a/demos/declarative/minehunt/MinehuntCore/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -Explosion 1.0 Explosion.qml -Tile 1.0 Tile.qml diff --git a/demos/declarative/minehunt/README b/demos/declarative/minehunt/README deleted file mode 100644 index 3849ca5fbf..0000000000 --- a/demos/declarative/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/demos/declarative/minehunt/main.cpp b/demos/declarative/minehunt/main.cpp deleted file mode 100644 index 9e7ab5f120..0000000000 --- a/demos/declarative/minehunt/main.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - -#include "minehunt.h" - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - QDeclarativeView canvas; - - qmlRegisterType(); - MinehuntGame* game = new MinehuntGame(); - -#ifdef Q_OS_SYMBIAN - canvas.setResizeMode(QDeclarativeView::SizeRootObjectToView); -#endif - canvas.engine()->rootContext()->setContextObject(game); - canvas.setSource(QString("qrc:minehunt.qml")); - QObject::connect(canvas.engine(), SIGNAL(quit()), &app, SLOT(quit())); - -#ifdef Q_OS_SYMBIAN - canvas.showFullScreen(); -#else - canvas.setGeometry(QRect(100, 100, 450, 450)); - canvas.show(); -#endif - return app.exec(); -} diff --git a/demos/declarative/minehunt/minehunt.cpp b/demos/declarative/minehunt/minehunt.cpp deleted file mode 100644 index c95f234ab3..0000000000 --- a/demos/declarative/minehunt/minehunt.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/minehunt/minehunt.h b/demos/declarative/minehunt/minehunt.h deleted file mode 100644 index d4a318dab9..0000000000 --- a/demos/declarative/minehunt/minehunt.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/minehunt/minehunt.pro b/demos/declarative/minehunt/minehunt.pro deleted file mode 100644 index a0220f2dc7..0000000000 --- a/demos/declarative/minehunt/minehunt.pro +++ /dev/null @@ -1,23 +0,0 @@ -TEMPLATE = app -TARGET = minehunt -QT += declarative - -# Input -HEADERS += minehunt.h -SOURCES += main.cpp minehunt.cpp -RESOURCES = minehunt.qrc - -sources.files = minehunt.qml minehunt.pro MinehuntCore -sources.path = $$[QT_INSTALL_DEMOS]/qtdeclarative/declarative/minehunt -target.path = $$[QT_INSTALL_DEMOS]/qtdeclarative/declarative/minehunt - -INSTALLS = sources target - -symbian:{ - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 - CONFIG += qt_demo - qmlminehuntfiles.files = MinehuntCore minehunt.qml - DEPLOYMENT += qmlminehuntfiles -} - diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml deleted file mode 100644 index 2129350625..0000000000 --- a/demos/declarative/minehunt/minehunt.qml +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 -import "MinehuntCore" 1.0 - -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/demos/declarative/minehunt/minehunt.qmlproject b/demos/declarative/minehunt/minehunt.qmlproject deleted file mode 100644 index d4909f8685..0000000000 --- a/demos/declarative/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: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/demos/declarative/minehunt/minehunt.qrc b/demos/declarative/minehunt/minehunt.qrc deleted file mode 100644 index fa8e27d383..0000000000 --- a/demos/declarative/minehunt/minehunt.qrc +++ /dev/null @@ -1,20 +0,0 @@ - - - minehunt.qml - MinehuntCore/Explosion.qml - MinehuntCore/Tile.qml - MinehuntCore/qmldir - MinehuntCore/pics/background.png - MinehuntCore/pics/back.png - MinehuntCore/pics/bomb-color.png - MinehuntCore/pics/bomb.png - MinehuntCore/pics/face-sad.png - MinehuntCore/pics/face-smile-big.png - MinehuntCore/pics/face-smile.png - MinehuntCore/pics/flag-color.png - MinehuntCore/pics/flag.png - MinehuntCore/pics/front.png - MinehuntCore/pics/quit.png - MinehuntCore/pics/star.png - - diff --git a/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml b/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml deleted file mode 100644 index 61005382da..0000000000 --- a/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml b/demos/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml deleted file mode 100644 index 14eb6439c0..0000000000 --- a/demos/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/photoviewer/PhotoViewerCore/Button.qml b/demos/declarative/photoviewer/PhotoViewerCore/Button.qml deleted file mode 100644 index 481bcc5a55..0000000000 --- a/demos/declarative/photoviewer/PhotoViewerCore/Button.qml +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml b/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml deleted file mode 100644 index 9c47310ebd..0000000000 --- a/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml b/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml deleted file mode 100644 index 4c1692cb08..0000000000 --- a/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml +++ /dev/null @@ -1,188 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml b/demos/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml deleted file mode 100644 index 805eac208e..0000000000 --- a/demos/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/photoviewer/PhotoViewerCore/RssModel.qml b/demos/declarative/photoviewer/PhotoViewerCore/RssModel.qml deleted file mode 100644 index 9f6c004952..0000000000 --- a/demos/declarative/photoviewer/PhotoViewerCore/RssModel.qml +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/photoviewer/PhotoViewerCore/Tag.qml b/demos/declarative/photoviewer/PhotoViewerCore/Tag.qml deleted file mode 100644 index 486a28d960..0000000000 --- a/demos/declarative/photoviewer/PhotoViewerCore/Tag.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/photoviewer/PhotoViewerCore/images/box-shadow.png b/demos/declarative/photoviewer/PhotoViewerCore/images/box-shadow.png deleted file mode 100644 index 431af8545d..0000000000 Binary files a/demos/declarative/photoviewer/PhotoViewerCore/images/box-shadow.png and /dev/null differ diff --git a/demos/declarative/photoviewer/PhotoViewerCore/images/busy.png b/demos/declarative/photoviewer/PhotoViewerCore/images/busy.png deleted file mode 100644 index 664c2b1491..0000000000 Binary files a/demos/declarative/photoviewer/PhotoViewerCore/images/busy.png and /dev/null differ diff --git a/demos/declarative/photoviewer/PhotoViewerCore/images/cardboard.png b/demos/declarative/photoviewer/PhotoViewerCore/images/cardboard.png deleted file mode 100644 index 1847ab528d..0000000000 Binary files a/demos/declarative/photoviewer/PhotoViewerCore/images/cardboard.png and /dev/null differ diff --git a/demos/declarative/photoviewer/PhotoViewerCore/qmldir b/demos/declarative/photoviewer/PhotoViewerCore/qmldir deleted file mode 100644 index d3c247f21a..0000000000 --- a/demos/declarative/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/demos/declarative/photoviewer/PhotoViewerCore/script/script.js b/demos/declarative/photoviewer/PhotoViewerCore/script/script.js deleted file mode 100644 index e8ef93a847..0000000000 --- a/demos/declarative/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/demos/declarative/photoviewer/i18n/base.ts b/demos/declarative/photoviewer/i18n/base.ts deleted file mode 100644 index 1accfd2f90..0000000000 --- a/demos/declarative/photoviewer/i18n/base.ts +++ /dev/null @@ -1,30 +0,0 @@ - - - - - AlbumDelegate - - - Remove - - - - - photoviewer - - - Add - - - - - Edit - - - - - Back - - - - diff --git a/demos/declarative/photoviewer/i18n/qml_fr.qm b/demos/declarative/photoviewer/i18n/qml_fr.qm deleted file mode 100644 index c24fcbc46c..0000000000 Binary files a/demos/declarative/photoviewer/i18n/qml_fr.qm and /dev/null differ diff --git a/demos/declarative/photoviewer/i18n/qml_fr.ts b/demos/declarative/photoviewer/i18n/qml_fr.ts deleted file mode 100644 index 9f892db616..0000000000 --- a/demos/declarative/photoviewer/i18n/qml_fr.ts +++ /dev/null @@ -1,30 +0,0 @@ - - - - - AlbumDelegate - - - Remove - Supprimer - - - - photoviewer - - - Add - Ajouter - - - - Edit - Éditer - - - - Back - Retour - - - diff --git a/demos/declarative/photoviewer/photoviewer.qml b/demos/declarative/photoviewer/photoviewer.qml deleted file mode 100644 index d2eaa56c1a..0000000000 --- a/demos/declarative/photoviewer/photoviewer.qml +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/photoviewer/photoviewer.qmlproject b/demos/declarative/photoviewer/photoviewer.qmlproject deleted file mode 100644 index d4909f8685..0000000000 --- a/demos/declarative/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: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/demos/declarative/plasmapatrol/PlasmaPatrol.qmlproject b/demos/declarative/plasmapatrol/PlasmaPatrol.qmlproject deleted file mode 100644 index 53f5ecb8d2..0000000000 --- a/demos/declarative/plasmapatrol/PlasmaPatrol.qmlproject +++ /dev/null @@ -1,18 +0,0 @@ -/* File generated by QtCreator */ - -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/demos/declarative/plasmapatrol/TODO b/demos/declarative/plasmapatrol/TODO deleted file mode 100644 index ef9d21a73d..0000000000 --- a/demos/declarative/plasmapatrol/TODO +++ /dev/null @@ -1,10 +0,0 @@ -Realistic Tasks: -Particle explosions on ship death. -Better help text (both content and styled a little nicer). -Hardpoint help showing them firing across the screen. -Endless Demo Mode - -Nice-but-i-doubt-it-will-get-done Tasks: -Particle Text for the winner. -Particle-based buttons. -Single player mode that is challenges (known opponents) to master the game with and earn achievements (in addition to 'skirmish'). diff --git a/demos/declarative/plasmapatrol/content/BlasterHardpoint.qml b/demos/declarative/plasmapatrol/content/BlasterHardpoint.qml deleted file mode 100644 index 1242a85149..0000000000 --- a/demos/declarative/plasmapatrol/content/BlasterHardpoint.qml +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item { - id: container - property variant target: {"y": -90, "x":12} - property Item targetObj: container - property Item hardpoint: container - property ParticleSystem system - property int blasts: 16 - property int bonusBlasts: 12 - property bool show: true - - width: 24 - height: 24 - Emitter{ - id: visualization - particle: "blaster" - system: container.system - emitting: show - anchors.fill: parent - shape: EllipseShape{} - speed: TargetedDirection{ targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true} - lifeSpan: 1000 - emitRate: 64 - - size: 24 - sizeVariation: 24 - endSize: 0 - } - - property int blastsLeft: 0 - function fireAt(targetArg, container){ - target = container.mapFromItem(targetArg, targetArg.width/2, targetArg.height/2); - targetObj = targetArg; - hardpoint = container; - blastsLeft = blasts; - rofTimer.repeat = true; - rofTimer.start(); - } - Timer{ - id: rofTimer - interval: 30;//Has to be greater than 1 frame or they stack up - running: false - repeat: false - onTriggered:{ - if(targetObj.hp <= 0) - return; - //TODO: calculate hit and damage at target, which must be a Ship - var hit; - if(blastsLeft >= bonusBlasts) - hit = Math.random() > targetObj.dodge; - else - hit = false; //purely aesthetic shots, because the damage isn't that fine grained - if(hit == true){ - switch(targetObj.shipType){ - case 1: hardpoint.damageDealt += 4; break; - case 2: hardpoint.damageDealt += 5; break; - case 3: hardpoint.damageDealt += 1; break; - default: hardpoint.damageDealt += 100; - } - } - blastVector.targetX = target.x; - blastVector.targetY = target.y; - if(!hit){//TODO: Actual targetVariation - blastVector.targetX += (128 * Math.random() - 64); - blastVector.targetY += (128 * Math.random() - 64); - } - emitter.burst(1); - blastsLeft--; - if(!blastsLeft) - rofTimer.repeat = false; - } - } - Emitter{ - id: emitter - particle: "blaster" - emitting: false - system: container.system - anchors.centerIn: parent - - lifeSpan: 1000 - emitRate: 16 - emitCap: blasts - size: 24 - endSize:16 - sizeVariation: 8 - speed: TargetedDirection{ - id: blastVector - targetX: target.x; targetY: target.y; magnitude: 1.1; proportionalMagnitude: true - } - } -} diff --git a/demos/declarative/plasmapatrol/content/Button.qml b/demos/declarative/plasmapatrol/content/Button.qml deleted file mode 100644 index 0d810e3b75..0000000000 --- a/demos/declarative/plasmapatrol/content/Button.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 - -//TODO: Add particles to this component too -Rectangle{ - id: container - property alias text: txt.text - signal clicked - //color: "lightsteelblue" - gradient: Gradient{ - GradientStop{ position: 0.0; color: "lightsteelblue" } - GradientStop{ position: 1.0; color: "steelblue" } - } - height: 64 - radius: 16 - width: 128 - Text{ - id: txt - anchors.centerIn: parent - font.pixelSize: 24 - color: "white" - } - MouseArea{ - anchors.fill: parent - onClicked: container.clicked() - } -} diff --git a/demos/declarative/plasmapatrol/content/CannonHardpoint.qml b/demos/declarative/plasmapatrol/content/CannonHardpoint.qml deleted file mode 100644 index b7572ef5c4..0000000000 --- a/demos/declarative/plasmapatrol/content/CannonHardpoint.qml +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item { - id: container - property variant target: {"y": -90, "x":12} - property ParticleSystem system - property bool show: true - - width: 24 - height: 24 - Emitter{ - id: visualization - particle: "cannon" - emitting: container.show - system: container.system - anchors.centerIn: parent - lifeSpan: 2000 - emitRate: 1 - - size: 4 - endSize: 0 - } - - function fireAt(targetArg, hardpoint){ - target = container.mapFromItem(targetArg, targetArg.width/2, targetArg.height/2); - if(container.hp <= 0 || targetArg.hp <= 0) - return; - //TODO: calculate hit and damage at target, which must be a Ship - var hit = Math.random() > targetArg.dodge - if(hit){ - switch(targetArg.shipType){ - case 1: hardpoint.damageDealt += 8; break; - case 2: hardpoint.damageDealt += 10; break; - case 3: hardpoint.damageDealt += 16; break; - default: hardpoint.damageDealt += 1000; - } - } - emitter.burst(1); - } - Emitter{ - id: emitter - particle: "cannon" - emitting: false - system: container.system - anchors.centerIn: parent - - lifeSpan: 1000 - emitRate: 1 - size: 8 - endSize: 4 - speed: TargetedDirection{ - id: blastVector - targetX: target.x; targetY: target.y; magnitude: 1.1; proportionalMagnitude: true - } - } -} diff --git a/demos/declarative/plasmapatrol/content/ChoiceBox.qml b/demos/declarative/plasmapatrol/content/ChoiceBox.qml deleted file mode 100644 index 1e64a76225..0000000000 --- a/demos/declarative/plasmapatrol/content/ChoiceBox.qml +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item{ - id: container - width: 360 - height: 160 - property ParticleSystem system - Ship{ - id: nully - system: system - } - property Item target: nully - /* - Component.onCompleted:{ - container.target.shipType = 1 - container.target.gunType = 1 - } - */ - Row{ - anchors.horizontalCenter: parent.horizontalCenter - height: parent.height - spacing: 8 - Button{ - width: 80 - height: 80 - anchors.verticalCenter: parent.verticalCenter - text: "Cycle\nShip" - onClicked: { - var nextVal = container.target.shipType; - if(nextVal == 3) - nextVal = 1; - else - nextVal++; - container.target.shipType = nextVal; - } - } - Item{ - width: 128 - height: 128 - anchors.verticalCenter: parent.verticalCenter - Ship{ - hp: 20 - anchors.centerIn: parent - shipType: container.target.shipType - gunType: container.target.gunType - system: container.system - } - } - Button{ - width: 80 - height: 80 - anchors.verticalCenter: parent.verticalCenter - text: "Cycle\nGun" - onClicked: { - var nextVal = container.target.gunType; - if(nextVal == 3) - nextVal = 1; - else - nextVal++; - container.target.gunType = nextVal; - } - } - } -} diff --git a/demos/declarative/plasmapatrol/content/Cruiser.qml b/demos/declarative/plasmapatrol/content/Cruiser.qml deleted file mode 100644 index a844fa1bb8..0000000000 --- a/demos/declarative/plasmapatrol/content/Cruiser.qml +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item { - id: container - property int maxHP: 100 - property int hp: maxHP - property real initialDodge: 0.01 - property real dodge: initialDodge - onHpChanged: if(hp <= 0) target = container; - property ParticleSystem system//TODO: Ship abstraction - property Item target: container - property string shipParticle: "default"//Per team colors? - property int gunType: 0 - width: 128 - height: 128 - Emitter{ - //TODO: Cooler would be an 'orbiting' affector - //TODO: On the subject, opacity and size should be grouped type 'overLife' if we can cram that in the particles - system: container.system - particle: container.shipParticle - anchors.centerIn: parent - width: 64 - height: 64 - shape: EllipseShape{} - - emitRate: hp > 0 ? hp * 1 + 20 : 0 - lifeSpan: 2400 - emitCap: (maxHP * 1 + 20)*2.4 - - size: 48 - sizeVariation: 16 - endSize: 16 - - speed: AngledDirection{angleVariation:360; magnitudeVariation: 32} - } - Emitter{ - system: container.system - particle: "cruiserArmor" - anchors.fill: parent - shape: EllipseShape{ fill: false } - emitting: hp>0 - - emitRate: 16 - lifeSpan: 2000 - - size: 48 - sizeVariation: 24 - - SpriteGoal{ - id: destructor - system: container.system - active: container.hp <=0 - anchors.fill: parent - particles: ["cruiserArmor"] - goalState: "death" -// jump: true - onceOff: true - } - } - - Timer{ - id: fireControl - property int next: Math.floor(Math.random() * 3) + 1 - interval: 800 - running: root.readySetGo - repeat: true - onTriggered:{ - if(next == 1){ - gun1.fireAt(container.target); - next = Math.floor(Math.random() * 3) + 1; - }else if(next == 2){ - gun2.fireAt(container.target); - next = Math.floor(Math.random() * 3) + 1; - }else if(next == 3){ - gun3.fireAt(container.target); - next = Math.floor(Math.random() * 3) + 1; - } - } - } - - Hardpoint{//TODO: Hardpoint abstraction - x: 112 - 12 - 8*2 - y: 128 - 12 - 12*2 - id: gun1 - system: container.system - show: hp > 0 - hardpointType: gunType - } - Hardpoint{ - x: 64 - 12 - y: 0 - 12 + 12*2 - id: gun2 - system: container.system - show: hp > 0 - hardpointType: gunType - } - Hardpoint{ - x: 16 - 12 + 8*2 - y: 128 - 12 - 12*2 - id: gun3 - system: container.system - show: hp > 0 - hardpointType: gunType - } -} diff --git a/demos/declarative/plasmapatrol/content/Frigate.qml b/demos/declarative/plasmapatrol/content/Frigate.qml deleted file mode 100644 index d31405250e..0000000000 --- a/demos/declarative/plasmapatrol/content/Frigate.qml +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item { - id: container - property int maxHP: 100 - property int hp: maxHP - property real initialDodge: 0.2 - property real dodge: initialDodge - onHpChanged: if(hp <= 0) target = container; - property ParticleSystem system//TODO: Ship abstraction - property Item target: container - property string shipParticle: "default"//Per team colors? - property int gunType: 0 - width: 128 - height: 128 - Emitter{ - system: container.system - particle: "frigateShield" - anchors.centerIn: parent - size: 92 - emitRate: 1 - lifeSpan: 4800 - emitting: hp > 0 - } - Emitter{ - system: container.system - particle: container.shipParticle - anchors.centerIn: parent - width: 64 - height: 16 - shape: EllipseShape{} - - size: 16 - sizeVariation: 8 - endSize: 8 - emitRate: hp > 0 ? hp * 1 + 20 : 0 - lifeSpan: 1200 - emitCap: (maxHP * 1 + 20)*2 - } - Timer{ - id: fireControl - property int next: Math.floor(Math.random() * 2) + 1 - interval: 800 - running: root.readySetGo - repeat: true - onTriggered:{ - if(next == 1){ - gun1.fireAt(container.target); - next = Math.floor(Math.random() * 2) + 1; - }else if(next == 2){ - gun2.fireAt(container.target); - next = Math.floor(Math.random() * 2) + 1; - } - } - } - - Hardpoint{ - x: 128 - 32 - 12 - y: 64 - 12 - id: gun1 - system: container.system - show: hp > 0 - hardpointType: gunType - } - Hardpoint{ - x: 0 + 32 - 12 - y: 64 - 12 - id: gun2 - system: container.system - show: hp > 0 - hardpointType: gunType - } -} diff --git a/demos/declarative/plasmapatrol/content/Hardpoint.qml b/demos/declarative/plasmapatrol/content/Hardpoint.qml deleted file mode 100644 index 3d4edb38f8..0000000000 --- a/demos/declarative/plasmapatrol/content/Hardpoint.qml +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item { - id: container - //ReflectiveProperties - //TransferredProperties - property variant target: {"y": -90, "x":12} - property ParticleSystem system - property bool show: true - property int hardpointType: 0 //default is pea shooter - always bad. - - property Item targetObj: null - property int damageDealt: 0 - onDamageDealtChanged: dealDamageTimer.start(); - Timer{ - id: dealDamageTimer - interval: 16 - running: false - repeat: false - onTriggered: {targetObj.hp -= damageDealt; damageDealt = 0;} - } - width: 24 - height: 24 - function fireAt(targetArg){//Each implement own - if(targetArg != null){ - hardpointLoader.item.fireAt(targetArg, container); - targetObj = targetArg; - } - } - Loader{ - id: hardpointLoader - sourceComponent: {switch(hardpointType){ - case 1: laserComponent; break; - case 2: blasterComponent; break; - case 3: cannonComponent; break; - default: emptyComponent; - }} - } - Component{ - id: laserComponent - LaserHardpoint{ - target: container.target - system: container.system - show: container.show - } - } - Component{ - id: blasterComponent - BlasterHardpoint{ - target: container.target - system: container.system - show: container.show - } - } - Component{ - id: cannonComponent - CannonHardpoint{ - target: container.target - system: container.system - show: container.show - } - } - Component{ - id: emptyComponent - Item { - function fireAt(obj){ - console.log("Firing null weapon. It hurts."); - } - } - } -} diff --git a/demos/declarative/plasmapatrol/content/HelpScreens.qml b/demos/declarative/plasmapatrol/content/HelpScreens.qml deleted file mode 100644 index 7e4fb9f1c9..0000000000 --- a/demos/declarative/plasmapatrol/content/HelpScreens.qml +++ /dev/null @@ -1,268 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -SequentialLoader { - id: hLdr - signal exitDesired - Component.onCompleted: advance(); - ParticleSystem{ id: helpSystem } - PlasmaPatrolParticles{ sys: helpSystem } - pages: [ - Component{Item{ - id: story - Text{ - color: "white" - text: "Story" - font.pixelSize: 48 - } - /* - Flickable{ - y: 60 - width: 360 - height: 500 - contentHeight: txt1.height - contentWidth: 360//TODO: Less magic numbers? - */ - Text{ - id: txt1 - color: "white" - y: 60 - font.pixelSize: 18 - text: " -In a remote nebula, a race of energy beings formed and lived prosperous lives for millenia. Until the schism - when they became constantly at each other's energy-throats. War soon followed, crippling both sides, until a truce was formed. But while governments knew the desparate need for peace, the soldiers in the ion-field were still filled with rampant bloodlust. On the border, patrols are constantly engaging in minor skirmishes whenever they cross paths. - -You must select one such patrol unit for the border, heading into an inevitable skirmish, in Plasma Patrol: the game of energy being spaceship combat! - " - width: 360 - wrapMode: Text.WordWrap - } - // } - Button{ - x: 20 - y: 560 - height: 40 - width: 120 - text: "Next" - onClicked: hLdr.advance(); - } - Button{ - x: 220 - y: 560 - height: 40 - width: 120 - text: "Menu" - onClicked: hLdr.exitDesired(); - } - }}, - Component{Item{ - id: ships - Text{ - color: "white" - text: "Vessels" - font.pixelSize: 48 - } - Column{ - spacing: 16 - y: 60 - Row{ - height: 128 - Sloop{ - system: helpSystem - } - Text{ - text: "The nimble sloop" - color: "white" - font.pixelSize: 18 - } - } - Row{ - height: 128 - Frigate{ - system: helpSystem - } - Text{ - text: "The versitile shield frigate" - color: "white" - font.pixelSize: 18 - } - } - Row{ - height: 128 - Cruiser{ - system: helpSystem - } - Text{ - text: "The armored cruiser" - color: "white" - font.pixelSize: 18 - } - } - } - Button{ - x: 20 - y: 560 - height: 40 - width: 120 - text: "Next" - onClicked: hLdr.advance(); - } - Button{ - x: 220 - y: 560 - height: 40 - width: 120 - text: "Menu" - onClicked: hLdr.exitDesired(); - } - }}, - Component{Item{ - id: guns - Text{ - color: "white" - text: "Hardpoints" - font.pixelSize: 48 - } - Column{ - spacing: 16 - y: 60 - Row{ - height: 128 - LaserHardpoint{ - system: helpSystem - } - Text{ - text: "The laser hardpoint almost always hits the target, even the nimble sloop, but loses much of its potency against the frigate's shields" - width: 332 - wrapMode: Text.WordWrap - color: "white" - font.pixelSize: 18 - } - } - Row{ - height: 128 - BlasterHardpoint{ - system: helpSystem - } - Text{ - text: "The blaster passes right through the frigate's shields but loses much of its impact against the armor of the cruiser" - width: 332 - wrapMode: Text.WordWrap - color: "white" - font.pixelSize: 18 - } - } - Row{ - height: 128 - CannonHardpoint{ - system: helpSystem - } - Text{ - text: "The cannon has poor accuracy, often missing the nimble sloop, but can punch right through the armor of the cruiser" - width: 332 - wrapMode: Text.WordWrap - color: "white" - font.pixelSize: 18 - } - } - } - Button{ - x: 20 - y: 560 - height: 40 - width: 120 - text: "Next" - onClicked: hLdr.advance(); - } - Button{ - x: 220 - y: 560 - height: 40 - width: 120 - text: "Menu" - onClicked: hLdr.exitDesired(); - } - }}, - Component{Item{ - id: strategy - Text{ - color: "white" - text: "Strategy" - font.pixelSize: 48 - } - Flickable{ - y: 60 - width: 360 - height: 500 - contentHeight: txt1.height - contentWidth: 360//TODO: Less magic numbers? - Text{ - id: txt1 - color: "white" - font.pixelSize: 18 - text: " -Basic Strategy: Good luck, have fun - don't die. -More to come after thorough playtesting. - " - width: 360 - wrapMode: Text.WordWrap - } - } - Button{ - x: 20 - y: 560 - height: 40 - width: 120 - text: "Story" - onClicked: {hLdr.at=0; hLdr.advance();} - } - Button{ - x: 220 - y: 560 - height: 40 - width: 120 - text: "Menu" - onClicked: hLdr.exitDesired(); - } - }} - ] -} diff --git a/demos/declarative/plasmapatrol/content/LaserHardpoint.qml b/demos/declarative/plasmapatrol/content/LaserHardpoint.qml deleted file mode 100644 index e99424856c..0000000000 --- a/demos/declarative/plasmapatrol/content/LaserHardpoint.qml +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item { - id: container - property variant target: {"y": -90, "x":12} - property ParticleSystem system - property bool show: true - - width: 24 - height: 24 - Emitter{ - id: visualization - particle: "laser" - system: container.system - anchors.fill: parent - emitting: container.show - shape: EllipseShape{} - speed: TargetedDirection{ targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true } - lifeSpan: 1000 - emitRate: 64 - - size: 24 - sizeVariation: 8 - endSize: 8 - } - - function fireAt(targetArg, hardpoint){ - if(targetArg.hp <= 0) - return; - //TODO: calculate hit and damage at target, which must be a Ship - var offset = 0; - if(Math.random() < 0.99){ - switch(targetArg.shipType){ - case 1: hardpoint.damageDealt += 16; break; - case 2: hardpoint.damageDealt += 4; break; - case 3: hardpoint.damageDealt += 8; break; - default: hardpoint.damageDealt += 500; //Really effective against unregistered vessels - } - }else{//Misses with Lasers are really rare - offset = Math.random() * 100; - } - target = container.mapFromItem(targetArg, offset + targetArg.width/2, offset + targetArg.height/2); - emitter.pulse(0.10); - // console.log("Fire box: " + Math.min(container.width/2, target.x) + "," + Math.min(container.height/2, target.y) + " " + (Math.max(container.width/2, target.x) - Math.min(container.width/2, target.x)) + "," + (Math.max(container.height/2, target.y) - Math.min(container.height/2, target.y))); - } - Emitter{ - id: emitter - particle: "laser" - emitting: false - system: container.system - x: Math.min(container.width/2, target.x); - width: Math.max(container.width/2, target.x) - x; - y: Math.min(container.height/2, target.y); - height: Math.max(container.height/2, target.y) - y; - shape: LineShape{ - mirrored: (emitter.y < 0 || emitter.x < 0) && !(emitter.y < 0 && emitter.x < 0 )//I just want XOR - } - - lifeSpan: 1000 - emitRate: 8000 - emitCap: 800 - size: 16 - endSize: 0 - - speed: PointDirection{xVariation: 4; yVariation: 4} - } -} diff --git a/demos/declarative/plasmapatrol/content/PlasmaPatrolParticles.qml b/demos/declarative/plasmapatrol/content/PlasmaPatrolParticles.qml deleted file mode 100644 index b65686e59e..0000000000 --- a/demos/declarative/plasmapatrol/content/PlasmaPatrolParticles.qml +++ /dev/null @@ -1,173 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item{ - property ParticleSystem sys - ImageParticle{ - system: sys - particles: ["default"] - source: "pics/blur-circle3.png" - color: "#003A3A3A" - colorVariation: 0.1 - z: 0 - } - ImageParticle{ - system: sys - particles: ["redTeam"] - source: "pics/blur-circle3.png" - color: "#0028060A" - colorVariation: 0.1 - z: 0 - } - ImageParticle{ - system: sys - particles: ["greenTeam"] - source: "pics/blur-circle3.png" - color: "#0006280A" - colorVariation: 0.1 - z: 0 - } - ImageParticle{ - system: sys - particles: ["blaster"] - source: "pics/star2.png" - //color: "#0F282406" - color: "#0F484416" - colorVariation: 0.2 - z: 2 - } - ImageParticle{ - system: sys - particles: ["laser"] - source: "pics/star3.png" - //color: "#00123F68" - color: "#00428FF8" - colorVariation: 0.2 - z: 2 - } - ImageParticle{ - system: sys - particles: ["cannon"] - source: "pics/particle.png" - color: "#80FFAAFF" - colorVariation: 0.1 - z: 2 - } - ImageParticle{ - system: sys - particles: ["cannonCore"] - source: "pics/particle.png" - color: "#00666666" - colorVariation: 0.8 - z: 1 - } - ImageParticle{ - system: sys - particles: ["cannonWake"] - source: "pics/star.png" - color: "#00CCCCCC" - colorVariation: 0.2 - z: 1 - } - ImageParticle{ - system: sys - particles: ["frigateShield"] - source: "pics/blur-circle2.png" - color: "#00000000" - colorVariation: 0.05 - blueVariation: 0.5 - greenVariation: 0.1 - z: 3 - } - ImageParticle{ - system: sys - particles: ["cruiserArmor"] - z: 1 - sprites:[Sprite{ - id: spinState - name: "spinning" - source: "pics/meteor.png" - frames: 35 - duration: 40 - to: {"death":0, "spinning":1} - },Sprite{ - name: "death" - source: "pics/meteor_explo.png" - frames: 22 - duration: 40 - to: {"null":1} - }, Sprite{ - name: "null" - source: "pics/nullRock.png" - frames: 1 - duration: 1000 - } - ] - } - FollowEmitter{ - system: sys - particle: "cannonWake" - follow: "cannon" - emitRatePerParticle: 64 - lifeSpan: 600 - speed: AngledDirection{ angleVariation: 360; magnitude: 48} - size: 16 - endSize: 8 - sizeVariation: 2 - emitting: true - width: 1000//XXX: Terrible hack - height: 1000 - } - FollowEmitter{ - system: sys - particle: "cannonCore" - follow: "cannon" - emitRatePerParticle: 256 - lifeSpan: 128 - size: 24 - endSize: 8 - emitting: true - width: 1000//XXX: Terrible hack - height: 1000 - } -} diff --git a/demos/declarative/plasmapatrol/content/SequentialLoader.qml b/demos/declarative/plasmapatrol/content/SequentialLoader.qml deleted file mode 100644 index 85a979b222..0000000000 --- a/demos/declarative/plasmapatrol/content/SequentialLoader.qml +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 - -Item{ - id: container - //TODO: Somehow get particles into this? - property list pages - property Item cur: null - property int at: 0 - function advance(){ - if(cur != null) - cur.destroy(); - cur = pages[at++].createObject(container); - } -} diff --git a/demos/declarative/plasmapatrol/content/Ship.qml b/demos/declarative/plasmapatrol/content/Ship.qml deleted file mode 100644 index ce8fb6073f..0000000000 --- a/demos/declarative/plasmapatrol/content/Ship.qml +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item { - id: me - //Reflective Properties - width: shipLoader.width - height: shipLoader.height - //Transfered Properties - property int hp: 100//shipLoader.item.maxHP - property real dodge: shipLoader.item.initialDodge - property ParticleSystem system - property int targetIdx: 0 - property Item target: targets[targetIdx] == undefined?null:targets[targetIdx] - Connections{ - target: me.target - onHpChanged: if(me.target.hp<=0) me.targetIdx++; - } - property list targets - property string shipParticle: "default"//Per team colors? - property int gunType: 0 - property int shipType: 0 - Component{ - id: sloopComp - Sloop{ - system: me.system - target: me.target - shipParticle: me.shipParticle - gunType: me.gunType - hp: me.hp - dodge: me.dodge - } - } - Component{ - id: frigateComp - Frigate{ - system: me.system - target: me.target - shipParticle: me.shipParticle - gunType: me.gunType - hp: me.hp - dodge: me.dodge - } - } - Component{ - id: cruiserComp - Cruiser{ - system: me.system - target: me.target - shipParticle: me.shipParticle - gunType: me.gunType - hp: me.hp - dodge: me.dodge - } - } - Component{ - id: dumbComp - Item{ - property int maxHP: 0 - property int initialDodge: 0 - } - } - Loader{ - id: shipLoader - sourceComponent:{ switch(shipType){ - case 1: sloopComp; break; - case 2: frigateComp; break; - case 3: cruiserComp; break; - default: dumbComp; - } - } - } -} diff --git a/demos/declarative/plasmapatrol/content/Sloop.qml b/demos/declarative/plasmapatrol/content/Sloop.qml deleted file mode 100644 index 1a6f3a9620..0000000000 --- a/demos/declarative/plasmapatrol/content/Sloop.qml +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Particles 2.0 - -Item { - id: container - property int maxHP: 100 - property int hp: maxHP - property real initialDodge: 0.5 - property real dodge: initialDodge - property int blinkInterval: 800 - onHpChanged: if(hp <= 0) target = container; - property ParticleSystem system//TODO: Ship abstraction - property Item target: container - property string shipParticle: "default"//Per team colors? - property int gunType: 0 - width: 128 - height: 128 - Emitter{ - id: emitter - //TODO: Cooler would be an 'orbiting' affector - //TODO: On the subject, opacity and size should be grouped type 'overLife' if we can cram that in the particles - system: container.system - particle: container.shipParticle - shape: EllipseShape{} - - emitRate: hp > 0 ? hp + 20 : 0 - lifeSpan: blinkInterval - emitCap: (maxHP + 20) - - acceleration: AngledDirection{angleVariation: 360; magnitude: 8} - - size: 24 - endSize: 4 - sizeVariation: 8 - width: 16 - height: 16 - x: 64 - y: 64 - Behavior on x{NumberAnimation{duration:blinkInterval}} - Behavior on y{NumberAnimation{duration:blinkInterval}} - Timer{ - interval: blinkInterval - running: true - repeat: true - onTriggered: { - emitter.x = Math.random() * 48 + 32 - emitter.y = Math.random() * 48 + 32 - } - } - } - Hardpoint{ - anchors.centerIn: parent - id: gun2 - system: container.system - show: container.hp > 0 - hardpointType: gunType - } - Timer{ - id: fireControl - interval: 800 - running: root.readySetGo - repeat: true - onTriggered:{ - gun2.fireAt(container.target); - } - } - -} diff --git a/demos/declarative/plasmapatrol/content/pics/TitleText.png b/demos/declarative/plasmapatrol/content/pics/TitleText.png deleted file mode 100644 index dc3acebe39..0000000000 Binary files a/demos/declarative/plasmapatrol/content/pics/TitleText.png and /dev/null differ diff --git a/demos/declarative/plasmapatrol/content/pics/blur-circle2.png b/demos/declarative/plasmapatrol/content/pics/blur-circle2.png deleted file mode 100644 index f7c9f3e98e..0000000000 Binary files a/demos/declarative/plasmapatrol/content/pics/blur-circle2.png and /dev/null differ diff --git a/demos/declarative/plasmapatrol/content/pics/blur-circle3.png b/demos/declarative/plasmapatrol/content/pics/blur-circle3.png deleted file mode 100644 index dbc39cb16e..0000000000 Binary files a/demos/declarative/plasmapatrol/content/pics/blur-circle3.png and /dev/null differ diff --git a/demos/declarative/plasmapatrol/content/pics/finalfrontier.png b/demos/declarative/plasmapatrol/content/pics/finalfrontier.png deleted file mode 100644 index 2ba1815230..0000000000 Binary files a/demos/declarative/plasmapatrol/content/pics/finalfrontier.png and /dev/null differ diff --git a/demos/declarative/plasmapatrol/content/pics/meteor.png b/demos/declarative/plasmapatrol/content/pics/meteor.png deleted file mode 100644 index e8c368aea7..0000000000 Binary files a/demos/declarative/plasmapatrol/content/pics/meteor.png and /dev/null differ diff --git a/demos/declarative/plasmapatrol/content/pics/meteor_explo.png b/demos/declarative/plasmapatrol/content/pics/meteor_explo.png deleted file mode 100644 index 4297245d49..0000000000 Binary files a/demos/declarative/plasmapatrol/content/pics/meteor_explo.png and /dev/null differ diff --git a/demos/declarative/plasmapatrol/content/pics/nullRock.png b/demos/declarative/plasmapatrol/content/pics/nullRock.png deleted file mode 100644 index 4076327a1a..0000000000 Binary files a/demos/declarative/plasmapatrol/content/pics/nullRock.png and /dev/null differ diff --git a/demos/declarative/plasmapatrol/content/pics/particle.png b/demos/declarative/plasmapatrol/content/pics/particle.png deleted file mode 100644 index 5c83896d22..0000000000 Binary files a/demos/declarative/plasmapatrol/content/pics/particle.png and /dev/null differ diff --git a/demos/declarative/plasmapatrol/content/pics/star.png b/demos/declarative/plasmapatrol/content/pics/star.png deleted file mode 100644 index 0d592cfa87..0000000000 Binary files a/demos/declarative/plasmapatrol/content/pics/star.png and /dev/null differ diff --git a/demos/declarative/plasmapatrol/content/pics/star2.png b/demos/declarative/plasmapatrol/content/pics/star2.png deleted file mode 100644 index bb55c44788..0000000000 Binary files a/demos/declarative/plasmapatrol/content/pics/star2.png and /dev/null differ diff --git a/demos/declarative/plasmapatrol/content/pics/star3.png b/demos/declarative/plasmapatrol/content/pics/star3.png deleted file mode 100644 index 636a25f480..0000000000 Binary files a/demos/declarative/plasmapatrol/content/pics/star3.png and /dev/null differ diff --git a/demos/declarative/plasmapatrol/plasmapatrol.qml b/demos/declarative/plasmapatrol/plasmapatrol.qml deleted file mode 100644 index dfc36ded01..0000000000 --- a/demos/declarative/plasmapatrol/plasmapatrol.qml +++ /dev/null @@ -1,386 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Particles 2.0 -import "content" - -Rectangle { - id: root - property bool readySetGo: false - //Debugging - property int hits: 0 - property int misses: 0 - property real ratio: hits/(misses?misses:1) - //Move to JS file? - property Ship redVar1: Ship{shipType: 1; gunType: 1} - property Ship redVar2: Ship{shipType: 1; gunType: 2} - property Ship redVar3: Ship{shipType: 1; gunType: 3} - property Ship greenVar1: Ship{shipType: 3; gunType: 1} - property Ship greenVar2: Ship{shipType: 2; gunType: 2} - property Ship greenVar3: Ship{shipType: 1; gunType: 3} - property string winner: "0" - property int players: 0 - function aiSet(ship){ - ship.gunType = Math.floor(Math.random() * 3) + 1 - ship.shipType = Math.floor(Math.random() * 3) + 1 - } - - width: 360 - height: 600 - color: "black" - SequentialLoader{ - anchors.fill: parent - //General Children - Image{ - anchors.centerIn: parent - source: "content/pics/finalfrontier.png" - } - ParticleSystem{ - id: particles - } - PlasmaPatrolParticles{ sys: particles; z: 100 }//Renders all particles on the one plane - //Component parts - id: pageControl - Component.onCompleted: advance(); - pages:[ - Component{Item{ - id: menu - width: root.width - height: root.height - Column{ - anchors.verticalCenter: parent.verticalCenter - width: parent.width - spacing: 8 - Item{ - id: title - width: root.width - height: 240 - Emitter{ - anchors.fill: parent - system: particles - emitting: true - particle: "default" - emitRate: 1200 - lifeSpan: 1200 - shape: MaskShape{source:"content/pics/TitleText.png"} - size: 16 - endSize: 0 - sizeVariation: 8 - speed: AngledDirection{angleVariation:360; magnitudeVariation: 6} - } - } - Button{ - text: "1P" - onClicked: {root.players = 1; pageControl.advance();} - anchors.horizontalCenter: parent.horizontalCenter - } - Button{ - text: "2P" - onClicked: {root.players = 2; pageControl.advance();} - anchors.horizontalCenter: parent.horizontalCenter - } - Button{ - text: "Demo" - anchors.horizontalCenter: parent.horizontalCenter - onClicked: {root.players = 0; - aiSet(redVar1); - aiSet(redVar2); - aiSet(redVar3); - aiSet(greenVar1); - aiSet(greenVar2); - aiSet(greenVar3); - pageControl.at = 5;//TODO: Not a magic number - pageControl.advance();} - } - Button{ - text: "Help" - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - pageControl.at = 7;//TODO: Not a magic number - pageControl.advance(); - } - } - Button{ - text: "Quit" - anchors.horizontalCenter: parent.horizontalCenter - onClicked: Qt.quit(); - } - } - }}, - Component{Item{ - id: p1Screen - z: 101 - width: root.width - height: root.height - Rectangle{ - anchors.fill: parent - color: "red" - } - Text{ - anchors.centerIn: parent - color: "white" - font.pixelSize: 64 - font.bold: true - text: "Player\n 1" - horizontalAlignment: Text.AlignHCenter - } - MouseArea{ - anchors.fill: parent - onClicked: pageControl.advance() - } - }}, - Component{Item{ - id: p1Choices - z: 3 - width: root.width - height: root.height - Rectangle{ - color: "black" - anchors.fill: parent - } - Column{ - spacing: 16 - width: root.width - anchors.horizontalCenter: parent.horizontalCenter - ChoiceBox{ - target: redVar1 - system: particles - } - ChoiceBox{ - target: redVar2 - system: particles - } - ChoiceBox{ - target: redVar3 - system: particles - } - Button{ - anchors.horizontalCenter: parent.horizontalCenter - text: "Next" - onClicked: { - if(root.players < 2){ - aiSet(greenVar1); - aiSet(greenVar2); - aiSet(greenVar3); - pageControl.at = 5;//TODO: Not a magic number - } - pageControl.advance(); - } - } - } - }}, - Component{Item{ - id: p2Screen - z: 101 - width: root.width - height: root.height - Rectangle{ - anchors.fill: parent - color: "green" - } - Text{ - anchors.centerIn: parent - color: "white" - font.pixelSize: 64 - font.bold: true - text: "Player\n 2" - horizontalAlignment: Text.AlignHCenter - } - MouseArea{ - anchors.fill: parent - onClicked: pageControl.advance() - } - }}, - Component{Item{ - id: p2Choices - z: 1 - width: root.width - height: root.height - Rectangle{ - color: "black" - anchors.fill: parent - } - Column{ - spacing: 16 - width: root.width - anchors.horizontalCenter: parent.horizontalCenter - ChoiceBox{ - target: greenVar1 - system: particles - } - ChoiceBox{ - target: greenVar2 - system: particles - } - ChoiceBox{ - target: greenVar3 - system: particles - } - Button{ - anchors.horizontalCenter: parent.horizontalCenter - text: "Next" - onClicked: pageControl.advance() - } - } - }}, - Component{Item{ - id: arena - width: root.width - height: root.height - z: 0 - Component.onCompleted: root.readySetGo = true - Component.onDestruction: root.readySetGo = false - property bool victory: redShip3.hp <= 0 || greenShip3.hp <=0 - onVictoryChanged: { - if(redShip3.hp <= 0){ - if(greenShip3.hp <= 0){ - root.winner = "1&2" - }else{ - root.winner = "2" - } - }else{ - root.winner = "1" - } - winTimer.start() - } - Timer{ - id: winTimer - interval: 1200 - repeat: false - running: false - onTriggered: pageControl.advance(); - } - Ship{ - id: redShip1 - shipParticle: "redTeam" - system: particles - x: 180-64 - y: 128 - shipType: redVar1.shipType - gunType: redVar1.gunType - targets: [greenShip1, greenShip2, greenShip3] - } - Ship{ - id: redShip2 - shipParticle: "redTeam" - system: particles - x: 0 - y: 0 - shipType: redVar2.shipType - gunType: redVar2.gunType - targets: [greenShip1, greenShip2, greenShip3] - } - Ship{ - id: redShip3 - shipParticle: "redTeam" - system: particles - x: 360-128 - y: 0 - shipType: redVar3.shipType - gunType: redVar3.gunType - targets: [greenShip1, greenShip2, greenShip3] - } - - Ship{ - id: greenShip1 - shipParticle: "greenTeam" - system: particles - x: 180-64 - y: 600 - 128 - 128 - shipType: greenVar1.shipType - gunType: greenVar1.gunType - targets: [redShip1, redShip2, redShip3] - } - Ship{ - id: greenShip2 - shipParticle: "greenTeam" - system: particles - x: 0 - y: 600-128 - shipType: greenVar2.shipType - gunType: greenVar2.gunType - targets: [redShip1, redShip2, redShip3] - } - Ship{ - id: greenShip3 - shipParticle: "greenTeam" - system: particles - x: 360 - 128 - y: 600 - 128 - shipType: greenVar3.shipType - gunType: greenVar3.gunType - targets: [redShip1, redShip2, redShip3] - } - }}, - Component{Item{ - id: winScreen - z: 101 - width: root.width - height: root.height - /* - Rectangle{ - anchors.fill: parent - color: "black" - } - */ - Text{//TODO: Particle Text? - anchors.fill: parent - color: "white" - font.pixelSize: 64 - font.bold: true - text: "Player " + root.winner + " wins!" - wrapMode: Text.WordWrap - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - MouseArea{ - anchors.fill: parent - onClicked: {pageControl.at = 0; pageControl.advance();} - } - }}, - Component{ - HelpScreens{ - onExitDesired: {pageControl.at = 0; pageControl.advance();} - } - } - ] - } -} diff --git a/demos/declarative/rssnews/content/BusyIndicator.qml b/demos/declarative/rssnews/content/BusyIndicator.qml deleted file mode 100644 index 3ee30d962b..0000000000 --- a/demos/declarative/rssnews/content/BusyIndicator.qml +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/rssnews/content/CategoryDelegate.qml b/demos/declarative/rssnews/content/CategoryDelegate.qml deleted file mode 100644 index 0ae9fbec13..0000000000 --- a/demos/declarative/rssnews/content/CategoryDelegate.qml +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/rssnews/content/NewsDelegate.qml b/demos/declarative/rssnews/content/NewsDelegate.qml deleted file mode 100644 index 061abb24fa..0000000000 --- a/demos/declarative/rssnews/content/NewsDelegate.qml +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/rssnews/content/RssFeeds.qml b/demos/declarative/rssnews/content/RssFeeds.qml deleted file mode 100644 index 09b1ad808c..0000000000 --- a/demos/declarative/rssnews/content/RssFeeds.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/rssnews/content/ScrollBar.qml b/demos/declarative/rssnews/content/ScrollBar.qml deleted file mode 100644 index e54be7b6a8..0000000000 --- a/demos/declarative/rssnews/content/ScrollBar.qml +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/rssnews/content/images/busy.png b/demos/declarative/rssnews/content/images/busy.png deleted file mode 100644 index 664c2b1491..0000000000 Binary files a/demos/declarative/rssnews/content/images/busy.png and /dev/null differ diff --git a/demos/declarative/rssnews/content/images/scrollbar.png b/demos/declarative/rssnews/content/images/scrollbar.png deleted file mode 100644 index 0228dcf9eb..0000000000 Binary files a/demos/declarative/rssnews/content/images/scrollbar.png and /dev/null differ diff --git a/demos/declarative/rssnews/rssnews.qml b/demos/declarative/rssnews/rssnews.qml deleted file mode 100644 index b2057a9ed3..0000000000 --- a/demos/declarative/rssnews/rssnews.qml +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/rssnews/rssnews.qmlproject b/demos/declarative/rssnews/rssnews.qmlproject deleted file mode 100644 index d4909f8685..0000000000 --- a/demos/declarative/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: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/demos/declarative/samegame/SamegameCore/BoomBlock.qml b/demos/declarative/samegame/SamegameCore/BoomBlock.qml deleted file mode 100644 index 2d8fdba2c9..0000000000 --- a/demos/declarative/samegame/SamegameCore/BoomBlock.qml +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.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 - } - Emitter { - id: particles - system: particleSystem - particle: { - if(type == 0){ - "red"; - } else if (type == 1) { - "blue"; - } else { - "green"; - } - } - anchors.fill: parent - - speed: TargetedDirection{targetX: block.width/2; targetY: block.height/2; magnitude: -60; magnitudeVariation: 60} - shape: EllipseShape{fill:true} - emitting: false; - lifeSpan: 700; lifeSpanVariation: 100 - emitRate: 1000 - emitCap: 100 //only fires 0.1s bursts (still 2x old number, ImageParticle wants less than 16000 max though) - size: 28 - endSize: 14 - } - - states: [ - State { - name: "AliveState"; when: spawned == true && dying == false - PropertyChanges { target: img; opacity: 1 } - }, - - State { - name: "DeathState"; when: dying == true - StateChangeScript { script: particles.pulse(0.1); } - PropertyChanges { target: img; opacity: 0 } - StateChangeScript { script: block.destroy(1000); } - } - ] -} diff --git a/demos/declarative/samegame/SamegameCore/Button.qml b/demos/declarative/samegame/SamegameCore/Button.qml deleted file mode 100644 index be9ad62dfd..0000000000 --- a/demos/declarative/samegame/SamegameCore/Button.qml +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -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/demos/declarative/samegame/SamegameCore/Dialog.qml b/demos/declarative/samegame/SamegameCore/Dialog.qml deleted file mode 100644 index aea6ac7dda..0000000000 --- a/demos/declarative/samegame/SamegameCore/Dialog.qml +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Rectangle { - id: page - - property Item text: dialogText - property bool open: false - - signal closed - signal opened - function forceClose() { - if(!open) - return; //already closed - page.open = false; - page.closed(); - page.opacity = 0; - } - - function show(txt) { - page.open = true; - 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/demos/declarative/samegame/SamegameCore/pics/background.png b/demos/declarative/samegame/SamegameCore/pics/background.png deleted file mode 100644 index 3734a27744..0000000000 Binary files a/demos/declarative/samegame/SamegameCore/pics/background.png and /dev/null differ diff --git a/demos/declarative/samegame/SamegameCore/pics/blueStone.png b/demos/declarative/samegame/SamegameCore/pics/blueStone.png deleted file mode 100644 index 20e43c75b6..0000000000 Binary files a/demos/declarative/samegame/SamegameCore/pics/blueStone.png and /dev/null differ diff --git a/demos/declarative/samegame/SamegameCore/pics/greenStone.png b/demos/declarative/samegame/SamegameCore/pics/greenStone.png deleted file mode 100644 index b568a1900c..0000000000 Binary files a/demos/declarative/samegame/SamegameCore/pics/greenStone.png and /dev/null differ diff --git a/demos/declarative/samegame/SamegameCore/pics/particle.png b/demos/declarative/samegame/SamegameCore/pics/particle.png deleted file mode 100644 index 5c83896d22..0000000000 Binary files a/demos/declarative/samegame/SamegameCore/pics/particle.png and /dev/null differ diff --git a/demos/declarative/samegame/SamegameCore/pics/redStone.png b/demos/declarative/samegame/SamegameCore/pics/redStone.png deleted file mode 100644 index 36b09a2686..0000000000 Binary files a/demos/declarative/samegame/SamegameCore/pics/redStone.png and /dev/null differ diff --git a/demos/declarative/samegame/SamegameCore/pics/yellowStone.png b/demos/declarative/samegame/SamegameCore/pics/yellowStone.png deleted file mode 100644 index b1ce76212c..0000000000 Binary files a/demos/declarative/samegame/SamegameCore/pics/yellowStone.png and /dev/null differ diff --git a/demos/declarative/samegame/SamegameCore/qmldir b/demos/declarative/samegame/SamegameCore/qmldir deleted file mode 100644 index e17b1f5d2b..0000000000 --- a/demos/declarative/samegame/SamegameCore/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -BoomBlock BoomBlock.qml -Button Button.qml -Dialog Dialog.qml diff --git a/demos/declarative/samegame/SamegameCore/samegame.js b/demos/declarative/samegame/SamegameCore/samegame.js deleted file mode 100755 index 4c5cbe5bb3..0000000000 --- a/demos/declarative/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 = "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/demos/declarative/samegame/highscores/README b/demos/declarative/samegame/highscores/README deleted file mode 100644 index eaa00fae37..0000000000 --- a/demos/declarative/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/demos/declarative/samegame/highscores/score_data.xml b/demos/declarative/samegame/highscores/score_data.xml deleted file mode 100755 index c3fd90d9cf..0000000000 --- a/demos/declarative/samegame/highscores/score_data.xml +++ /dev/null @@ -1,2 +0,0 @@ -1000000Alan the Tester0x00 -6213Alan12x1751 diff --git a/demos/declarative/samegame/highscores/score_style.xsl b/demos/declarative/samegame/highscores/score_style.xsl deleted file mode 100755 index 670354c965..0000000000 --- a/demos/declarative/samegame/highscores/score_style.xsl +++ /dev/null @@ -1,28 +0,0 @@ - - - - - SameGame High Scores - -

SameGame High Scores

- - - - - - - - - - - - - - - - -
NameScoreGrid SizeTime, s
- - -
-
diff --git a/demos/declarative/samegame/highscores/scores.php b/demos/declarative/samegame/highscores/scores.php deleted file mode 100755 index 3cceb2d738..0000000000 --- a/demos/declarative/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/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml deleted file mode 100644 index 0daf72de58..0000000000 --- a/demos/declarative/samegame/samegame.qml +++ /dev/null @@ -1,192 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 -import "SamegameCore" -import "SamegameCore/samegame.js" as Logic - -Rectangle { - id: screen - width: 360; height: 640 - 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); - } - } - Item{ - ParticleSystem{ id: particleSystem; } - ImageParticle { - system: particleSystem - particles: ["red"] - color: Qt.darker("red");//Actually want desaturated... - source: "SamegameCore/pics/particle.png" - colorVariation: 0.4 - alpha: 0.1 - } - ImageParticle { - system: particleSystem - particles: ["green"] - color: Qt.darker("green");//Actually want desaturated... - source: "SamegameCore/pics/particle.png" - colorVariation: 0.4 - alpha: 0.1 - } - ImageParticle { - system: particleSystem - particles: ["blue"] - color: Qt.darker("blue");//Actually want desaturated... - source: "SamegameCore/pics/particle.png" - colorVariation: 0.4 - alpha: 0.1 - } - id: aboveGameCanvas - anchors.fill: gameCanvas - z: gameCanvas.z + 1 - } - } - - 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/demos/declarative/samegame/samegame.qmlproject b/demos/declarative/samegame/samegame.qmlproject deleted file mode 100644 index d4909f8685..0000000000 --- a/demos/declarative/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: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/demos/declarative/shadereffects/Slider.qml b/demos/declarative/shadereffects/Slider.qml deleted file mode 100644 index e31335d984..0000000000 --- a/demos/declarative/shadereffects/Slider.qml +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Declarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - property real value: bar.x / (foo.width - bar.width) - Item { - id: foo - width: parent.width - 4 - height: 6 - anchors.centerIn: parent - - Rectangle { - height: parent.height - anchors.left: parent.left - anchors.right: bar.horizontalCenter - color: "blue" - radius: 3 - } - Rectangle { - height: parent.height - anchors.left: bar.horizontalCenter - anchors.right: parent.right - color: "gray" - radius: 3 - } - Rectangle { - anchors.fill: parent - color: "transparent" - radius: 3 - border.width: 2 - border.color: "black" - } - - Rectangle { - id: bar - y: -7 - width: 20 - height: 20 - radius: 15 - color: "white" - border.width: 2 - border.color: "black" - MouseArea { - anchors.fill: parent - drag.target: parent - drag.axis: Drag.XAxis - drag.minimumX: 0 - drag.maximumX: foo.width - parent.width - } - } - } -} - diff --git a/demos/declarative/shadereffects/face-smile.png b/demos/declarative/shadereffects/face-smile.png deleted file mode 100644 index 3d66d72578..0000000000 Binary files a/demos/declarative/shadereffects/face-smile.png and /dev/null differ diff --git a/demos/declarative/shadereffects/qt-logo.png b/demos/declarative/shadereffects/qt-logo.png deleted file mode 100644 index 7d3e97eb36..0000000000 Binary files a/demos/declarative/shadereffects/qt-logo.png and /dev/null differ diff --git a/demos/declarative/shadereffects/shader-demo.qml b/demos/declarative/shadereffects/shader-demo.qml deleted file mode 100644 index 1226064a5d..0000000000 --- a/demos/declarative/shadereffects/shader-demo.qml +++ /dev/null @@ -1,295 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Declarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Image { - width: 640 - height: 360 - source: "../snake/content/pics/background.png" - - ShaderEffectSource { - id: theSource - sourceItem: theItem - smooth: true - } - - function saturate(x) { - return Math.min(Math.max(x, 0), 1) - } - - function sliderToColor(x) { - return Qt.rgba(saturate(Math.max(2 - 6 * x, 6 * x - 4)), - saturate(Math.min(6 * x, 4 - 6 * x)), - saturate(Math.min(6 * x - 2, 6 - 6 * x))) - } - - Grid { - anchors.centerIn: parent - columns: 3 - - Item { - id: theItem - width: 180 - height: 180 - ListView { - anchors.centerIn: parent - width: 160 - height: 140 - clip: true - snapMode: ListView.SnapOneItem - model: VisualItemModel { - Text { - width: 160 - height: 140 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - font.pixelSize: 120 - font.family: "Times" - color: "blue" - text: "Qt" - } - Image { - width: 160 - height: 140 - source: "qt-logo.png" - smooth: true - } - Image { - width: 160 - height: 140 - source: "face-smile.png" - smooth: true - } - } - } - } - ShaderEffectItem { - width: 180 - height: 180 - property variant source: theSource - property real amplitude: 0.04 * wobbleSlider.value - property real frequency: 20 - property real time: 0 - NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 } - fragmentShader: - "uniform highp float amplitude;" + - "uniform highp float frequency;" + - "uniform highp float time;" + - "uniform sampler2D source;" + - "varying highp vec2 qt_TexCoord0;" + - "void main() {" + - " highp vec2 p = sin(time + frequency * qt_TexCoord0);" + - " gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x));" + - "}" - Slider { - id: wobbleSlider - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - height: 40 - } - } - ShaderEffectItem { - width: 180 - height: 180 - property variant source: theSource - property variant shadow: ShaderEffectSource { - smooth: true - sourceItem: ShaderEffectItem { - width: theItem.width - height: theItem.height - property variant delta: Qt.size(0.0, 1.0 / height) - property variant source: ShaderEffectSource { - smooth: true - sourceItem: ShaderEffectItem { - width: theItem.width - height: theItem.height - property variant delta: Qt.size(1.0 / width, 0.0) - property variant source: theSource - fragmentShader: " - uniform sampler2D source; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - void main() { - gl_FragColor = 0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta) - + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta) - + 0.2466 * texture2D(source, qt_TexCoord0) - + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta) - + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta); - }" - } - } - fragmentShader: " - uniform sampler2D source; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - void main() { - gl_FragColor = 0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta) - + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta) - + 0.2466 * texture2D(source, qt_TexCoord0) - + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta) - + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta); - }" - } - } - property real angle: 0 - property variant offset: Qt.point(15.0 * Math.cos(angle), 15.0 * Math.sin(angle)) - NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 } - property variant delta: Qt.size(offset.x / width, offset.y / height) - property real darkness: shadowSlider.value - fragmentShader: " - uniform highp vec2 offset; - uniform sampler2D source; - uniform sampler2D shadow; - uniform highp float darkness; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - void main() { - lowp vec4 fg = texture2D(source, qt_TexCoord0); - lowp vec4 bg = texture2D(shadow, qt_TexCoord0 + delta); - gl_FragColor = fg + vec4(0., 0., 0., darkness * bg.a) * (1. - fg.a); - }" - Slider { - id: shadowSlider - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - height: 40 - } - } - ShaderEffectItem { - width: 180 - height: 180 - property variant source: theSource - property variant delta: Qt.size(0.5 / width, 0.5 / height) - fragmentShader: " - uniform sampler2D source; - uniform highp vec2 delta; - uniform highp float qt_Opacity; - varying highp vec2 qt_TexCoord0; - void main() { - lowp vec4 tl = texture2D(source, qt_TexCoord0 - delta); - lowp vec4 tr = texture2D(source, qt_TexCoord0 + vec2(delta.x, -delta.y)); - lowp vec4 bl = texture2D(source, qt_TexCoord0 - vec2(delta.x, -delta.y)); - lowp vec4 br = texture2D(source, qt_TexCoord0 + delta); - lowp vec4 gx = (tl + bl) - (tr + br); - lowp vec4 gy = (tl + tr) - (bl + br); - gl_FragColor.xyz = vec3(0.); - gl_FragColor.w = clamp(dot(sqrt(gx * gx + gy * gy), vec4(1.)), 0., 1.) * qt_Opacity; - }" - } - ShaderEffectItem { - width: 180 - height: 180 - property variant source: theSource - property color tint: sliderToColor(colorizeSlider.value) - fragmentShader: " - uniform sampler2D source; - uniform lowp vec4 tint; - uniform lowp float qt_Opacity; - varying highp vec2 qt_TexCoord0; - void main() { - lowp vec4 c = texture2D(source, qt_TexCoord0); - lowp float lo = min(min(c.x, c.y), c.z); - lowp float hi = max(max(c.x, c.y), c.z); - gl_FragColor = qt_Opacity * vec4(mix(vec3(lo), vec3(hi), tint.xyz), c.w); - }" - Slider { - id: colorizeSlider - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - height: 40 - } - } - ShaderEffectItem { - width: 180 - height: 180 - mesh: GridMesh { resolution: Qt.size(10, 10) } - property variant source: theSource - property real bend: 0 - property real minimize: 0 - property real side: genieSlider.value - SequentialAnimation on bend { - loops: Animation.Infinite - NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine } - PauseAnimation { duration: 1600 } - NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine } - PauseAnimation { duration: 1000 } - } - SequentialAnimation on minimize { - loops: Animation.Infinite - PauseAnimation { duration: 300 } - NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine } - PauseAnimation { duration: 1000 } - NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine } - PauseAnimation { duration: 1300 } - } - vertexShader: " - uniform highp mat4 qt_ModelViewProjectionMatrix; - uniform highp float bend; - uniform highp float minimize; - uniform highp float side; - uniform highp float width; - uniform highp float height; - attribute highp vec4 qt_Vertex; - attribute highp vec2 qt_MultiTexCoord0; - varying highp vec2 qt_TexCoord0; - void main() { - qt_TexCoord0 = qt_MultiTexCoord0; - highp vec4 pos = qt_Vertex; - pos.y = mix(qt_Vertex.y, height, minimize); - highp float t = pos.y / height; - t = (3. - 2. * t) * t * t; - pos.x = mix(qt_Vertex.x, side * width, t * bend); - gl_Position = qt_ModelViewProjectionMatrix * pos; - }" - Slider { - id: genieSlider - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - height: 40 - } - } - } -} diff --git a/demos/declarative/snake/content/Button.qml b/demos/declarative/snake/content/Button.qml deleted file mode 100644 index d8a3363d6d..0000000000 --- a/demos/declarative/snake/content/Button.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/snake/content/Cookie.qml b/demos/declarative/snake/content/Cookie.qml deleted file mode 100644 index 29b56f9e88..0000000000 --- a/demos/declarative/snake/content/Cookie.qml +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/snake/content/HighScoreModel.qml b/demos/declarative/snake/content/HighScoreModel.qml deleted file mode 100644 index 91b2185ffc..0000000000 --- a/demos/declarative/snake/content/HighScoreModel.qml +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/snake/content/Link.qml b/demos/declarative/snake/content/Link.qml deleted file mode 100644 index ff67ad749e..0000000000 --- a/demos/declarative/snake/content/Link.qml +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/snake/content/Skull.qml b/demos/declarative/snake/content/Skull.qml deleted file mode 100644 index 4f48145f84..0000000000 --- a/demos/declarative/snake/content/Skull.qml +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/snake/content/pics/README b/demos/declarative/snake/content/pics/README deleted file mode 100644 index 0215132caa..0000000000 --- a/demos/declarative/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/demos/declarative/snake/content/pics/background.png b/demos/declarative/snake/content/pics/background.png deleted file mode 100644 index 72dffaa843..0000000000 Binary files a/demos/declarative/snake/content/pics/background.png and /dev/null differ diff --git a/demos/declarative/snake/content/pics/blueStar.png b/demos/declarative/snake/content/pics/blueStar.png deleted file mode 100644 index ba7acabd26..0000000000 Binary files a/demos/declarative/snake/content/pics/blueStar.png and /dev/null differ diff --git a/demos/declarative/snake/content/pics/blueStone.png b/demos/declarative/snake/content/pics/blueStone.png deleted file mode 100644 index 356affdd95..0000000000 Binary files a/demos/declarative/snake/content/pics/blueStone.png and /dev/null differ diff --git a/demos/declarative/snake/content/pics/cookie.png b/demos/declarative/snake/content/pics/cookie.png deleted file mode 100644 index aec2957f34..0000000000 Binary files a/demos/declarative/snake/content/pics/cookie.png and /dev/null differ diff --git a/demos/declarative/snake/content/pics/eyes.svg b/demos/declarative/snake/content/pics/eyes.svg deleted file mode 100644 index 1078692725..0000000000 --- a/demos/declarative/snake/content/pics/eyes.svg +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - - - - - - - diff --git a/demos/declarative/snake/content/pics/head.png b/demos/declarative/snake/content/pics/head.png deleted file mode 100644 index 550e002687..0000000000 Binary files a/demos/declarative/snake/content/pics/head.png and /dev/null differ diff --git a/demos/declarative/snake/content/pics/head.svg b/demos/declarative/snake/content/pics/head.svg deleted file mode 100644 index 3bf0bd2feb..0000000000 --- a/demos/declarative/snake/content/pics/head.svg +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - diff --git a/demos/declarative/snake/content/pics/pause.png b/demos/declarative/snake/content/pics/pause.png deleted file mode 100644 index 056d97dd17..0000000000 Binary files a/demos/declarative/snake/content/pics/pause.png and /dev/null differ diff --git a/demos/declarative/snake/content/pics/redStar.png b/demos/declarative/snake/content/pics/redStar.png deleted file mode 100644 index cd06854719..0000000000 Binary files a/demos/declarative/snake/content/pics/redStar.png and /dev/null differ diff --git a/demos/declarative/snake/content/pics/redStone.png b/demos/declarative/snake/content/pics/redStone.png deleted file mode 100644 index 9bb7fe4277..0000000000 Binary files a/demos/declarative/snake/content/pics/redStone.png and /dev/null differ diff --git a/demos/declarative/snake/content/pics/skull.png b/demos/declarative/snake/content/pics/skull.png deleted file mode 100644 index 63186167bd..0000000000 Binary files a/demos/declarative/snake/content/pics/skull.png and /dev/null differ diff --git a/demos/declarative/snake/content/pics/snake.jpg b/demos/declarative/snake/content/pics/snake.jpg deleted file mode 100644 index e91a784f71..0000000000 Binary files a/demos/declarative/snake/content/pics/snake.jpg and /dev/null differ diff --git a/demos/declarative/snake/content/pics/star.png b/demos/declarative/snake/content/pics/star.png deleted file mode 100644 index defbde53ca..0000000000 Binary files a/demos/declarative/snake/content/pics/star.png and /dev/null differ diff --git a/demos/declarative/snake/content/pics/stoneShadow.png b/demos/declarative/snake/content/pics/stoneShadow.png deleted file mode 100644 index 1bd56afd04..0000000000 Binary files a/demos/declarative/snake/content/pics/stoneShadow.png and /dev/null differ diff --git a/demos/declarative/snake/content/pics/yellowStar.png b/demos/declarative/snake/content/pics/yellowStar.png deleted file mode 100644 index 52fb9c4b78..0000000000 Binary files a/demos/declarative/snake/content/pics/yellowStar.png and /dev/null differ diff --git a/demos/declarative/snake/content/pics/yellowStone.png b/demos/declarative/snake/content/pics/yellowStone.png deleted file mode 100644 index c56124a895..0000000000 Binary files a/demos/declarative/snake/content/pics/yellowStone.png and /dev/null differ diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js deleted file mode 100644 index 837b82addd..0000000000 --- a/demos/declarative/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/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml deleted file mode 100644 index edccd4c9df..0000000000 --- a/demos/declarative/snake/snake.qml +++ /dev/null @@ -1,272 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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 && runtime.isActiveWindow - 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/demos/declarative/snake/snake.qmlproject b/demos/declarative/snake/snake.qmlproject deleted file mode 100644 index d4909f8685..0000000000 --- a/demos/declarative/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: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/demos/declarative/twitter/TwitterCore/Button.qml b/demos/declarative/twitter/TwitterCore/Button.qml deleted file mode 100644 index 34ca181527..0000000000 --- a/demos/declarative/twitter/TwitterCore/Button.qml +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/twitter/TwitterCore/FatDelegate.qml b/demos/declarative/twitter/TwitterCore/FatDelegate.qml deleted file mode 100644 index 1fe289159c..0000000000 --- a/demos/declarative/twitter/TwitterCore/FatDelegate.qml +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/twitter/TwitterCore/Input.qml b/demos/declarative/twitter/TwitterCore/Input.qml deleted file mode 100644 index 96fafb6bd2..0000000000 --- a/demos/declarative/twitter/TwitterCore/Input.qml +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/twitter/TwitterCore/Loading.qml b/demos/declarative/twitter/TwitterCore/Loading.qml deleted file mode 100644 index e0c4fa03eb..0000000000 --- a/demos/declarative/twitter/TwitterCore/Loading.qml +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml b/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml deleted file mode 100644 index 6933d485c0..0000000000 --- a/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/twitter/TwitterCore/RssModel.qml b/demos/declarative/twitter/TwitterCore/RssModel.qml deleted file mode 100644 index 696ae9d24d..0000000000 --- a/demos/declarative/twitter/TwitterCore/RssModel.qml +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/twitter/TwitterCore/SearchView.qml b/demos/declarative/twitter/TwitterCore/SearchView.qml deleted file mode 100644 index 6e099ae1c7..0000000000 --- a/demos/declarative/twitter/TwitterCore/SearchView.qml +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/twitter/TwitterCore/TitleBar.qml b/demos/declarative/twitter/TwitterCore/TitleBar.qml deleted file mode 100644 index 1a2f5d5855..0000000000 --- a/demos/declarative/twitter/TwitterCore/TitleBar.qml +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/twitter/TwitterCore/ToolBar.qml b/demos/declarative/twitter/TwitterCore/ToolBar.qml deleted file mode 100644 index b277517332..0000000000 --- a/demos/declarative/twitter/TwitterCore/ToolBar.qml +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/twitter/TwitterCore/UserModel.qml b/demos/declarative/twitter/TwitterCore/UserModel.qml deleted file mode 100644 index b87a083eae..0000000000 --- a/demos/declarative/twitter/TwitterCore/UserModel.qml +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/twitter/TwitterCore/images/gloss.png b/demos/declarative/twitter/TwitterCore/images/gloss.png deleted file mode 100644 index 5d370cd93d..0000000000 Binary files a/demos/declarative/twitter/TwitterCore/images/gloss.png and /dev/null differ diff --git a/demos/declarative/twitter/TwitterCore/images/lineedit.png b/demos/declarative/twitter/TwitterCore/images/lineedit.png deleted file mode 100644 index 2cc38dc35b..0000000000 Binary files a/demos/declarative/twitter/TwitterCore/images/lineedit.png and /dev/null differ diff --git a/demos/declarative/twitter/TwitterCore/images/lineedit.sci b/demos/declarative/twitter/TwitterCore/images/lineedit.sci deleted file mode 100644 index 054bff78be..0000000000 --- a/demos/declarative/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/demos/declarative/twitter/TwitterCore/images/loading.png b/demos/declarative/twitter/TwitterCore/images/loading.png deleted file mode 100644 index 47a1589c5d..0000000000 Binary files a/demos/declarative/twitter/TwitterCore/images/loading.png and /dev/null differ diff --git a/demos/declarative/twitter/TwitterCore/images/quit.png b/demos/declarative/twitter/TwitterCore/images/quit.png deleted file mode 100644 index 5bda1b6e0d..0000000000 Binary files a/demos/declarative/twitter/TwitterCore/images/quit.png and /dev/null differ diff --git a/demos/declarative/twitter/TwitterCore/images/stripes.png b/demos/declarative/twitter/TwitterCore/images/stripes.png deleted file mode 100644 index 9f36727ea4..0000000000 Binary files a/demos/declarative/twitter/TwitterCore/images/stripes.png and /dev/null differ diff --git a/demos/declarative/twitter/TwitterCore/images/titlebar.png b/demos/declarative/twitter/TwitterCore/images/titlebar.png deleted file mode 100644 index 51c90082d0..0000000000 Binary files a/demos/declarative/twitter/TwitterCore/images/titlebar.png and /dev/null differ diff --git a/demos/declarative/twitter/TwitterCore/images/titlebar.sci b/demos/declarative/twitter/TwitterCore/images/titlebar.sci deleted file mode 100644 index 0418d94cd6..0000000000 --- a/demos/declarative/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/demos/declarative/twitter/TwitterCore/images/toolbutton.png b/demos/declarative/twitter/TwitterCore/images/toolbutton.png deleted file mode 100644 index 11310013ee..0000000000 Binary files a/demos/declarative/twitter/TwitterCore/images/toolbutton.png and /dev/null differ diff --git a/demos/declarative/twitter/TwitterCore/images/toolbutton.sci b/demos/declarative/twitter/TwitterCore/images/toolbutton.sci deleted file mode 100644 index 9e4f965307..0000000000 --- a/demos/declarative/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/demos/declarative/twitter/TwitterCore/qmldir b/demos/declarative/twitter/TwitterCore/qmldir deleted file mode 100644 index 84d85c2885..0000000000 --- a/demos/declarative/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/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml deleted file mode 100644 index 1700b5dcd1..0000000000 --- a/demos/declarative/twitter/twitter.qml +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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/demos/declarative/twitter/twitter.qmlproject b/demos/declarative/twitter/twitter.qmlproject deleted file mode 100644 index d4909f8685..0000000000 --- a/demos/declarative/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: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/demos/demos.pro b/demos/demos.pro deleted file mode 100644 index 09881f1a9c..0000000000 --- a/demos/demos.pro +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += declarative diff --git a/demos/embedded/embedded.pro b/demos/embedded/embedded.pro deleted file mode 100644 index 81334fa552..0000000000 --- a/demos/embedded/embedded.pro +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += qmleasing qmlflickr qmldialcontrol qmlcalculator qmlphotoviewer qmlclocks qmltwitter diff --git a/demos/embedded/qmlcalculator/deployment.pri b/demos/embedded/qmlcalculator/deployment.pri deleted file mode 100644 index a97498e91f..0000000000 --- a/demos/embedded/qmlcalculator/deployment.pri +++ /dev/null @@ -1,8 +0,0 @@ -qmlcalculator_src = $$PWD/../../declarative/calculator -symbian { - load(data_caging_paths) - qmlcalculator_uid3 = A000E3FB - qmlcalculator_files.path = $$APP_PRIVATE_DIR_BASE/$$qmlcalculator_uid3 -} -qmlcalculator_files.files = $$qmlcalculator_src/calculator.qml $$qmlcalculator_src/Core -DEPLOYMENT += qmlcalculator_files diff --git a/demos/embedded/qmlcalculator/qmlcalculator.cpp b/demos/embedded/qmlcalculator/qmlcalculator.cpp deleted file mode 100644 index bed579726c..0000000000 --- a/demos/embedded/qmlcalculator/qmlcalculator.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - -#if defined(Q_OS_SYMBIAN) -#include -#include -#include -#include -#endif // Q_OS_SYMBIAN - -int main(int argc, char *argv[]) -{ - QApplication application(argc, argv); - - const QString mainQmlApp = QLatin1String("calculator.qml"); - QDeclarativeView view; - view.setSource(QUrl(mainQmlApp)); - view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); - -#if defined(QT_KEYPAD_NAVIGATION) - QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); -#endif // QT_KEYPAD_NAVIGATION - -#if defined(Q_OS_SYMBIAN) - CAknAppUi* appUi = dynamic_cast (CEikonEnv::Static()->AppUi()); - TRAPD(error, - if (appUi) - appUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait) - ) - view.showFullScreen(); -#else // Q_OS_SYMBIAN - view.show(); -#endif // Q_OS_SYMBIAN - - return application.exec(); -} diff --git a/demos/embedded/qmlcalculator/qmlcalculator.pro b/demos/embedded/qmlcalculator/qmlcalculator.pro deleted file mode 100644 index 4a82d32227..0000000000 --- a/demos/embedded/qmlcalculator/qmlcalculator.pro +++ /dev/null @@ -1,12 +0,0 @@ -!symbian:!wince*:warning("DEPLOYMENT support required. This project only works on Symbian and WinCE.") - -QT += declarative -SOURCES += $$PWD/qmlcalculator.cpp -include($$PWD/deployment.pri) - -symbian { - TARGET.UID3 = 0x$$qmlcalculator_uid3 # defined in deployment.pri - CONFIG += qt_demo - TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 - LIBS += -lcone -leikcore -lavkon # Screen orientation -} diff --git a/demos/embedded/qmlclocks/deployment.pri b/demos/embedded/qmlclocks/deployment.pri deleted file mode 100644 index 6c6704ccc7..0000000000 --- a/demos/embedded/qmlclocks/deployment.pri +++ /dev/null @@ -1,8 +0,0 @@ -qmlclocks_src = $$PWD/../../../examples/declarative/toys/clocks -symbian { - load(data_caging_paths) - qmlclocks_uid3 = A000E3FC - qmlclocks_files.path = $$APP_PRIVATE_DIR_BASE/$$qmlclocks_uid3 -} -qmlclocks_files.files = $$qmlclocks_src/clocks.qml $$qmlclocks_src/content -DEPLOYMENT += qmlclocks_files diff --git a/demos/embedded/qmlclocks/qmlclocks.cpp b/demos/embedded/qmlclocks/qmlclocks.cpp deleted file mode 100644 index 75d0be0874..0000000000 --- a/demos/embedded/qmlclocks/qmlclocks.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - -#if defined(Q_OS_SYMBIAN) -#include -#include -#include -#include -#endif // Q_OS_SYMBIAN - -int main(int argc, char *argv[]) -{ - QApplication application(argc, argv); - - const QString mainQmlApp = QLatin1String("clocks.qml"); - QDeclarativeView view; - view.setSource(QUrl(mainQmlApp)); - view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); - -#if defined(QT_KEYPAD_NAVIGATION) - QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); -#endif // QT_KEYPAD_NAVIGATION - -#if defined(Q_OS_SYMBIAN) - CAknAppUi* appUi = dynamic_cast (CEikonEnv::Static()->AppUi()); - TRAPD(error, - if (appUi) - appUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape) - ) - view.showFullScreen(); -#else // Q_OS_SYMBIAN - view.show(); -#endif // Q_OS_SYMBIAN - - return application.exec(); -} diff --git a/demos/embedded/qmlclocks/qmlclocks.pro b/demos/embedded/qmlclocks/qmlclocks.pro deleted file mode 100644 index cc97a7394b..0000000000 --- a/demos/embedded/qmlclocks/qmlclocks.pro +++ /dev/null @@ -1,12 +0,0 @@ -!symbian:!wince*:warning("DEPLOYMENT support required. This project only works on Symbian and WinCE.") - -QT += declarative -SOURCES += $$PWD/qmlclocks.cpp -include($$PWD/deployment.pri) - -symbian { - TARGET.UID3 = 0x$$qmlclocks_uid3 # defined in deployment.pri - CONFIG += qt_demo - TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 - LIBS += -lcone -leikcore -lavkon # Screen orientation -} diff --git a/demos/embedded/qmldialcontrol/deployment.pri b/demos/embedded/qmldialcontrol/deployment.pri deleted file mode 100644 index a9784439a4..0000000000 --- a/demos/embedded/qmldialcontrol/deployment.pri +++ /dev/null @@ -1,8 +0,0 @@ -qmldialcontrol_src = $$PWD/../../../examples/declarative/ui-components/dialcontrol -symbian { - load(data_caging_paths) - qmldialcontrol_uid3 = A000E3FD - qmldialcontrol_files.path = $$APP_PRIVATE_DIR_BASE/$$qmldialcontrol_uid3 -} -qmldialcontrol_files.files = $$qmldialcontrol_src/dialcontrol.qml $$qmldialcontrol_src/content -DEPLOYMENT += qmldialcontrol_files diff --git a/demos/embedded/qmldialcontrol/qmldialcontrol.cpp b/demos/embedded/qmldialcontrol/qmldialcontrol.cpp deleted file mode 100644 index 7cc4ed6668..0000000000 --- a/demos/embedded/qmldialcontrol/qmldialcontrol.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - QApplication application(argc, argv); - - const QString mainQmlApp = QLatin1String("dialcontrol.qml"); - QDeclarativeView view; - view.setSource(QUrl(mainQmlApp)); - view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); - -#if defined(QT_KEYPAD_NAVIGATION) - QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); -#endif // QT_KEYPAD_NAVIGATION - -#if defined(Q_OS_SYMBIAN) - view.showFullScreen(); -#else // Q_OS_SYMBIAN - view.show(); -#endif // Q_OS_SYMBIAN - - return application.exec(); -} diff --git a/demos/embedded/qmldialcontrol/qmldialcontrol.pro b/demos/embedded/qmldialcontrol/qmldialcontrol.pro deleted file mode 100644 index 348c41a85d..0000000000 --- a/demos/embedded/qmldialcontrol/qmldialcontrol.pro +++ /dev/null @@ -1,11 +0,0 @@ -!symbian:!wince*:warning("DEPLOYMENT support required. This project only works on Symbian and WinCE.") - -QT += declarative -SOURCES += $$PWD/qmldialcontrol.cpp -include($$PWD/deployment.pri) - -symbian { - TARGET.UID3 = 0x$$qmldialcontrol_uid3 # defined in deployment.pri - CONFIG += qt_demo - TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 -} diff --git a/demos/embedded/qmleasing/deployment.pri b/demos/embedded/qmleasing/deployment.pri deleted file mode 100644 index 946fcd9d89..0000000000 --- a/demos/embedded/qmleasing/deployment.pri +++ /dev/null @@ -1,8 +0,0 @@ -qmleasing_src = $$PWD/../../../examples/declarative/animation/easing -symbian { - load(data_caging_paths) - qmleasing_uid3 = A000E3FE - qmleasing_files.path = $$APP_PRIVATE_DIR_BASE/$$qmleasing_uid3 -} -qmleasing_files.files = $$qmleasing_src/easing.qml $$qmleasing_src/content -DEPLOYMENT += qmleasing_files diff --git a/demos/embedded/qmleasing/qmleasing.cpp b/demos/embedded/qmleasing/qmleasing.cpp deleted file mode 100644 index 38c457d376..0000000000 --- a/demos/embedded/qmleasing/qmleasing.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - QApplication application(argc, argv); - - const QString mainQmlApp = QLatin1String("easing.qml"); - QDeclarativeView view; - view.setSource(QUrl(mainQmlApp)); - view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); - -#if defined(QT_KEYPAD_NAVIGATION) - QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); -#endif // QT_KEYPAD_NAVIGATION - -#if defined(Q_OS_SYMBIAN) - view.showFullScreen(); -#else // Q_OS_SYMBIAN - view.show(); -#endif // Q_OS_SYMBIAN - - return application.exec(); -} diff --git a/demos/embedded/qmleasing/qmleasing.pro b/demos/embedded/qmleasing/qmleasing.pro deleted file mode 100644 index 9d7c8d7d00..0000000000 --- a/demos/embedded/qmleasing/qmleasing.pro +++ /dev/null @@ -1,11 +0,0 @@ -!symbian:!wince*:warning("DEPLOYMENT support required. This project only works on Symbian and WinCE.") - -QT += declarative -SOURCES += $$PWD/qmleasing.cpp -include($$PWD/deployment.pri) - -symbian { - TARGET.UID3 = 0x$$qmleasing_uid3 # defined in deployment.pri - CONFIG += qt_demo - TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 -} diff --git a/demos/embedded/qmlflickr/deployment.pri b/demos/embedded/qmlflickr/deployment.pri deleted file mode 100644 index a38dc95f8c..0000000000 --- a/demos/embedded/qmlflickr/deployment.pri +++ /dev/null @@ -1,8 +0,0 @@ -qmlflickr_src = $$PWD/../../declarative/flickr -symbian { - load(data_caging_paths) - qmlflickr_uid3 = A000E3FF - qmlflickr_files.path = $$APP_PRIVATE_DIR_BASE/$$qmlflickr_uid3 -} -qmlflickr_files.files = $$qmlflickr_src/flickr.qml $$qmlflickr_src/common $$qmlflickr_src/mobile -DEPLOYMENT += qmlflickr_files diff --git a/demos/embedded/qmlflickr/qmlflickr.cpp b/demos/embedded/qmlflickr/qmlflickr.cpp deleted file mode 100644 index 052d11c48a..0000000000 --- a/demos/embedded/qmlflickr/qmlflickr.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Factory to create QNetworkAccessManagers that use the saved network configuration; otherwise -// the system default. -class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory -{ -public: - ~NetworkAccessManagerFactory() { } - - QNetworkAccessManager *create(QObject *parent); -}; - -QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) -{ - QNetworkAccessManager *accessManager = new QNetworkAccessManager(parent); - - QNetworkConfigurationManager manager; - if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) { - // Get saved network configuration - QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); - settings.beginGroup(QLatin1String("QtNetwork")); - const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString(); - settings.endGroup(); - - // If the saved network configuration is not currently discovered use the system default - QNetworkConfiguration config = manager.configurationFromIdentifier(id); - if ((config.state() & QNetworkConfiguration::Discovered) != - QNetworkConfiguration::Discovered) { - config = manager.defaultConfiguration(); - } - - accessManager->setConfiguration(config); - } - - return accessManager; -} - -int main(int argc, char *argv[]) -{ - QApplication application(argc, argv); - - NetworkAccessManagerFactory networkAccessManagerFactory; - - const QString mainQmlApp = QLatin1String("flickr.qml"); - QDeclarativeView view; - view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory); - view.setSource(QUrl(mainQmlApp)); - view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); - -#if defined(Q_OS_SYMBIAN) - view.showFullScreen(); -#else // Q_OS_SYMBIAN - view.setGeometry(QRect(100, 100, 360, 640)); - view.show(); -#endif // Q_OS_SYMBIAN - return application.exec(); -} - diff --git a/demos/embedded/qmlflickr/qmlflickr.pro b/demos/embedded/qmlflickr/qmlflickr.pro deleted file mode 100644 index a70a6df894..0000000000 --- a/demos/embedded/qmlflickr/qmlflickr.pro +++ /dev/null @@ -1,13 +0,0 @@ -!symbian:!wince*:warning("DEPLOYMENT support required. This project only works on Symbian and WinCE.") - -QT += declarative network -SOURCES += $$PWD/qmlflickr.cpp -include($$PWD/deployment.pri) - -symbian { - TARGET.UID3 = 0x$$qmlflickr_uid3 # defined in deployment.pri - CONFIG += qt_demo - TARGET.CAPABILITY = NetworkServices - # Maximum heap size set to 128 MB in order to allow loading large images. - TARGET.EPOCHEAPSIZE = 0x20000 0x8000000 -} diff --git a/demos/embedded/qmlphotoviewer/deployment.pri b/demos/embedded/qmlphotoviewer/deployment.pri deleted file mode 100644 index 23882e3686..0000000000 --- a/demos/embedded/qmlphotoviewer/deployment.pri +++ /dev/null @@ -1,8 +0,0 @@ -qmlphotoviewer_src = $$PWD/../../declarative/photoviewer -symbian { - load(data_caging_paths) - qmlphotoviewer_uid3 = A000E400 - qmlphotoviewer_files.path = $$APP_PRIVATE_DIR_BASE/$$qmlphotoviewer_uid3 -} -qmlphotoviewer_files.files = $$qmlphotoviewer_src/photoviewer.qml $$qmlphotoviewer_src/PhotoViewerCore -DEPLOYMENT += qmlphotoviewer_files diff --git a/demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp b/demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp deleted file mode 100644 index 89a0902373..0000000000 --- a/demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Factory to create QNetworkAccessManagers that use the saved network configuration; otherwise -// the system default. -class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory -{ -public: - ~NetworkAccessManagerFactory() { } - - QNetworkAccessManager *create(QObject *parent); -}; - -QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) -{ - QNetworkAccessManager *accessManager = new QNetworkAccessManager(parent); - - QNetworkConfigurationManager manager; - if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) { - // Get saved network configuration - QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); - settings.beginGroup(QLatin1String("QtNetwork")); - const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString(); - settings.endGroup(); - - // If the saved network configuration is not currently discovered use the system default - QNetworkConfiguration config = manager.configurationFromIdentifier(id); - if ((config.state() & QNetworkConfiguration::Discovered) != - QNetworkConfiguration::Discovered) { - config = manager.defaultConfiguration(); - } - - accessManager->setConfiguration(config); - } - - return accessManager; -} - -int main(int argc, char *argv[]) -{ - QApplication application(argc, argv); - - NetworkAccessManagerFactory networkAccessManagerFactory; - - const QString mainQmlApp = QLatin1String("photoviewer.qml"); - QDeclarativeView view; - view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory); - view.setSource(QUrl(mainQmlApp)); - view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - - QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); - -#if defined(Q_OS_SYMBIAN) - view.showFullScreen(); -#else // Q_OS_SYMBIAN - view.setGeometry(QRect(100, 100, 360, 640)); - view.show(); -#endif // Q_OS_SYMBIAN - return application.exec(); -} - diff --git a/demos/embedded/qmlphotoviewer/qmlphotoviewer.pro b/demos/embedded/qmlphotoviewer/qmlphotoviewer.pro deleted file mode 100644 index ce6ff552cb..0000000000 --- a/demos/embedded/qmlphotoviewer/qmlphotoviewer.pro +++ /dev/null @@ -1,12 +0,0 @@ -!symbian:!wince*:warning("DEPLOYMENT support required. This project only works on Symbian and WinCE.") - -QT += declarative network -SOURCES += $$PWD/qmlphotoviewer.cpp -include($$PWD/deployment.pri) - -symbian { - TARGET.UID3 = 0x$$qmlphotoviewer_uid3 # defined in deployment.pri - CONFIG += qt_demo - TARGET.CAPABILITY = NetworkServices - TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 -} diff --git a/demos/embedded/qmltwitter/deployment.pri b/demos/embedded/qmltwitter/deployment.pri deleted file mode 100644 index 3edc0e527c..0000000000 --- a/demos/embedded/qmltwitter/deployment.pri +++ /dev/null @@ -1,8 +0,0 @@ -qmltwitter_src = $$PWD/../../declarative/twitter -symbian { - load(data_caging_paths) - qmltwitter_uid3 = A000E401 - qmltwitter_files.path = $$APP_PRIVATE_DIR_BASE/$$qmltwitter_uid3 -} -qmltwitter_files.files = $$qmltwitter_src/twitter.qml $$qmltwitter_src/TwitterCore -DEPLOYMENT += qmltwitter_files diff --git a/demos/embedded/qmltwitter/qmltwitter.cpp b/demos/embedded/qmltwitter/qmltwitter.cpp deleted file mode 100644 index f63f9055ef..0000000000 --- a/demos/embedded/qmltwitter/qmltwitter.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Factory to create QNetworkAccessManagers that use the saved network configuration; otherwise -// the system default. -class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory -{ -public: - ~NetworkAccessManagerFactory() { } - - QNetworkAccessManager *create(QObject *parent); -}; - -QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) -{ - QNetworkAccessManager *accessManager = new QNetworkAccessManager(parent); - - QNetworkConfigurationManager manager; - if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) { - // Get saved network configuration - QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); - settings.beginGroup(QLatin1String("QtNetwork")); - const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString(); - settings.endGroup(); - - // If the saved network configuration is not currently discovered use the system default - QNetworkConfiguration config = manager.configurationFromIdentifier(id); - if ((config.state() & QNetworkConfiguration::Discovered) != - QNetworkConfiguration::Discovered) { - config = manager.defaultConfiguration(); - } - - accessManager->setConfiguration(config); - } - - return accessManager; -} - -int main(int argc, char *argv[]) -{ - QApplication application(argc, argv); - - NetworkAccessManagerFactory networkAccessManagerFactory; - - const QString mainQmlApp = QLatin1String("twitter.qml"); - QDeclarativeView view; - view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory); - view.setSource(QUrl(mainQmlApp)); - view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); - -#if defined(Q_OS_SYMBIAN) - view.showFullScreen(); -#else // Q_OS_SYMBIAN - view.setGeometry(QRect(100, 100, 360, 640)); - view.show(); -#endif // Q_OS_SYMBIAN - return application.exec(); -} - diff --git a/demos/embedded/qmltwitter/qmltwitter.pro b/demos/embedded/qmltwitter/qmltwitter.pro deleted file mode 100644 index 197afd3431..0000000000 --- a/demos/embedded/qmltwitter/qmltwitter.pro +++ /dev/null @@ -1,12 +0,0 @@ -!symbian:!wince*:warning("DEPLOYMENT support required. This project only works on Symbian and WinCE.") - -QT += declarative network -SOURCES += $$PWD/qmltwitter.cpp -include($$PWD/deployment.pri) - -symbian { - TARGET.UID3 = 0x$$qmltwitter_uid3 # defined in deployment.pri - CONFIG += qt_demo - TARGET.CAPABILITY = NetworkServices - TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 -} diff --git a/examples/declarative/calculator/Core/Button.qml b/examples/declarative/calculator/Core/Button.qml new file mode 100644 index 0000000000..c5ec39cea8 --- /dev/null +++ b/examples/declarative/calculator/Core/Button.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/Core/Display.qml b/examples/declarative/calculator/Core/Display.qml new file mode 100644 index 0000000000..5e27897bae --- /dev/null +++ b/examples/declarative/calculator/Core/Display.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/Core/calculator.js b/examples/declarative/calculator/Core/calculator.js new file mode 100644 index 0000000000..7c363c7f30 --- /dev/null +++ b/examples/declarative/calculator/Core/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/Core/images/button-.png b/examples/declarative/calculator/Core/images/button-.png new file mode 100644 index 0000000000..544e514536 Binary files /dev/null and b/examples/declarative/calculator/Core/images/button-.png differ diff --git a/examples/declarative/calculator/Core/images/button-blue.png b/examples/declarative/calculator/Core/images/button-blue.png new file mode 100644 index 0000000000..5f92de32d0 Binary files /dev/null and b/examples/declarative/calculator/Core/images/button-blue.png differ diff --git a/examples/declarative/calculator/Core/images/button-green.png b/examples/declarative/calculator/Core/images/button-green.png new file mode 100644 index 0000000000..36c93914c7 Binary files /dev/null and b/examples/declarative/calculator/Core/images/button-green.png differ diff --git a/examples/declarative/calculator/Core/images/button-purple.png b/examples/declarative/calculator/Core/images/button-purple.png new file mode 100644 index 0000000000..347cbbea9d Binary files /dev/null and b/examples/declarative/calculator/Core/images/button-purple.png differ diff --git a/examples/declarative/calculator/Core/images/button-red.png b/examples/declarative/calculator/Core/images/button-red.png new file mode 100644 index 0000000000..3b335891ae Binary files /dev/null and b/examples/declarative/calculator/Core/images/button-red.png differ diff --git a/examples/declarative/calculator/Core/images/display.png b/examples/declarative/calculator/Core/images/display.png new file mode 100644 index 0000000000..9507f4382e Binary files /dev/null and b/examples/declarative/calculator/Core/images/display.png differ diff --git a/examples/declarative/calculator/Core/qmldir b/examples/declarative/calculator/Core/qmldir new file mode 100644 index 0000000000..a926b93fac --- /dev/null +++ b/examples/declarative/calculator/Core/qmldir @@ -0,0 +1,2 @@ +Button Button.qml +Display Display.qml diff --git a/examples/declarative/calculator/calculator.qml b/examples/declarative/calculator/calculator.qml new file mode 100644 index 0000000000..c844c710aa --- /dev/null +++ b/examples/declarative/calculator/calculator.qml @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "Core" +import "Core/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/calculator/calculator.qmlproject b/examples/declarative/calculator/calculator.qmlproject new file mode 100644 index 0000000000..d4909f8685 --- /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: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/declarative.pro b/examples/declarative/declarative.pro index cbeb7e9e26..c2950616a2 100644 --- a/examples/declarative/declarative.pro +++ b/examples/declarative/declarative.pro @@ -3,9 +3,10 @@ TEMPLATE = subdirs # These examples contain some C++ and need to be built SUBDIRS = \ cppextensions \ + minehunt \ modelviews \ - tutorials \ - painteditem + painteditem \ + tutorials # plugins uses a 'Time' class that conflicts with symbian e32std.h also defining a class of the same name symbian:SUBDIRS -= plugins @@ -13,18 +14,27 @@ symbian:SUBDIRS -= plugins # These examples contain no C++ and can simply be copied sources.files = \ animation \ + calculator \ cppextensions \ + flickr \ i18n \ imageelements \ keyinteraction \ + photoviewer \ positioners \ + rssnews \ + samegame \ + snake \ sqllocalstorage \ text \ threading \ touchinteraction \ toys \ + twitter \ ui-components \ + webbrowser \ xml + sources.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/declarative INSTALLS += sources diff --git a/examples/declarative/flickr/content/Button.qml b/examples/declarative/flickr/content/Button.qml new file mode 100644 index 0000000000..7285753a0a --- /dev/null +++ b/examples/declarative/flickr/content/Button.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.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/content/GridDelegate.qml b/examples/declarative/flickr/content/GridDelegate.qml new file mode 100644 index 0000000000..5b7af23ea0 --- /dev/null +++ b/examples/declarative/flickr/content/GridDelegate.qml @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.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/content/ImageDetails.qml b/examples/declarative/flickr/content/ImageDetails.qml new file mode 100644 index 0000000000..74346466e3 --- /dev/null +++ b/examples/declarative/flickr/content/ImageDetails.qml @@ -0,0 +1,355 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +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 + + property int flipDuration: 1600 + + 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 } + + 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; + } + if (inBackState && bigImage.status == Image.Ready) + effectBox.imageInAnim(); + } + property bool inBackState: false + onInBackStateChanged:{ + if(inBackState && bigImage.status == Image.Ready) + effectBox.imageInAnim(); + else if (!inBackState && bigImage.status == Image.Ready) + effectBox.imageOutAnim(); + } + } + ShaderEffectSource{ + id: pictureSource + sourceItem: bigImage + smooth: true + //Workaround: Doesn't work below lines + width: bigImage.width + height: bigImage.width + visible: false + } + Turbulence{//only fill visible rect + id: turbulence + system: imageSystem + anchors.fill: parent + frequency: 100 + strength: 250 + active: false + } + + Item{ + id: effectBox + width: bigImage.width * bigImage.scale + height: bigImage.height * bigImage.scale + anchors.centerIn: parent + function imageInAnim(){ + bigImage.visible = false; + noiseIn.visible = true; + endEffectTimer.start(); + } + function imageOutAnim(){ + bigImage.visible = false; + noiseIn.visible = false; + turbulence.active = true; + endEffectTimer.start(); + pixelEmitter.burst(2048); + } + Timer{ + id: endEffectTimer + interval: flipDuration + repeat: false + running: false + onTriggered:{ + turbulence.active = false; + noiseIn.visible = false; + bigImage.visible = true; + } + } + ShaderEffectItem{ + id: noiseIn + anchors.fill: parent + property real t: 0 + visible: false + onVisibleChanged: tAnim.start() + NumberAnimation{ + id: tAnim + target: noiseIn + property: "t" + from: 0.0 + to: 1.0 + duration: flipDuration + } + property variant source: pictureSource + property variant noise: ShaderEffectSource{ + sourceItem:Image{ + source: "images/noise.png" + } + hideSource: true + smooth: false + } + fragmentShader:" + uniform sampler2D noise; + uniform sampler2D source; + uniform highp float t; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + void main(){ + //Want to use noise2, but it always returns (0,0)? + if(texture2D(noise, qt_TexCoord0).w <= t) + gl_FragColor = texture2D(source, qt_TexCoord0) * qt_Opacity; + else + gl_FragColor = vec4(0.,0.,0.,0.); + } + " + } + ParticleSystem{ + id: imageSystem + } + Emitter{ + id: pixelEmitter + system: imageSystem + //anchors.fill: parent + width: Math.min(bigImage.width * bigImage.scale, flickable.width); + height: Math.min(bigImage.height * bigImage.scale, flickable.height); + anchors.centerIn: parent + size: 4 + lifeSpan: flipDuration + emitRate: 2048 + emitting: false + } + CustomParticle{ + id: blowOut + system: imageSystem + property real maxWidth: effectBox.width + property real maxHeight: effectBox.height + vertexShader:" + attribute highp vec2 vPos; + attribute highp vec2 vTex; + attribute highp vec4 vData; // x = time, y = lifeSpan, z = size, w = endSize + attribute highp vec4 vVec; // x,y = constant speed, z,w = acceleration + attribute highp float r; + + uniform highp float maxWidth; + uniform highp float maxHeight; + + uniform highp mat4 qt_ModelViewProjectionMatrix; + uniform highp float timestamp; + uniform lowp float qt_Opacity; + + varying highp vec2 fTex2; + varying lowp float fFade; + + void main() { + fTex2 = vec2(vPos.x / maxWidth, vPos.y / maxHeight); + highp float size = vData.z; + highp float endSize = vData.w; + + highp float t = (timestamp - vData.x) / vData.y; + + highp float currentSize = mix(size, endSize, t * t); + + if (t < 0. || t > 1.) + currentSize = 0.; + + highp vec2 pos = vPos + - currentSize / 2. + currentSize * vTex // adjust size + + vVec.xy * t * vData.y // apply speed vector.. + + 0.5 * vVec.zw * pow(t * vData.y, 2.); + + gl_Position = qt_ModelViewProjectionMatrix * vec4(pos.x, pos.y, 0, 1); + + highp float fadeIn = min(t * 10., 1.); + highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.)); + + fFade = 1.0;//fadeIn * fadeOut * qt_Opacity; + } + " + property variant pictureTexture: pictureSource + fragmentShader: " + uniform sampler2D pictureTexture; + varying highp vec2 fTex2; + varying highp float fFade; + void main() { + gl_FragColor = texture2D(pictureTexture, fTex2) * fFade; + }" + } + + + + } + } + } + + Text { + text: "Image Unavailable" + visible: bigImage.status == Image.Error + anchors.centerIn: parent; color: "white"; font.bold: true + } + + 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" } + PropertyChanges { target: bigImage; inBackState: true } + } + + transitions: Transition { + SequentialAnimation { + PropertyAction { target: bigImage; property: "smooth"; value: false } + NumberAnimation { easing.type: Easing.InOutQuad; properties: "angle"; duration: flipDuration } + PropertyAction { target: bigImage; property: "smooth"; value: !flickable.movingVertically } + } + } +} diff --git a/examples/declarative/flickr/content/ListDelegate.qml b/examples/declarative/flickr/content/ListDelegate.qml new file mode 100644 index 0000000000..b65704867b --- /dev/null +++ b/examples/declarative/flickr/content/ListDelegate.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.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/content/Progress.qml b/examples/declarative/flickr/content/Progress.qml new file mode 100644 index 0000000000..73a91a4aa9 --- /dev/null +++ b/examples/declarative/flickr/content/Progress.qml @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Item{ + id: container + 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" } + } + } + + ParticleSystem{ + running: container.visible + id: barSys + } + ImageParticle{ + color: "lightsteelblue" + alpha: 0.1 + colorVariation: 0.05 + source: "images/particle.png" + system: barSys + } + Emitter{ + y: 2; height: parent.height-4; + x: 2; width: Math.max(parent.width * progress - 4, 0); + speed: AngledDirection{ angleVariation: 180; magnitudeVariation: 12 } + system: barSys + emitRate: width; + lifeSpan: 1000 + size: 20 + sizeVariation: 4 + endSize: 12 + emitCap: parent.width; + } + + Text { + text: Math.round(progress * 100) + "%" + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + color: Qt.rgba(1.0, 1.0 - progress, 1.0 - progress,0.9); font.bold: true; font.pixelSize: 15 + } +} diff --git a/examples/declarative/flickr/content/RssModel.qml b/examples/declarative/flickr/content/RssModel.qml new file mode 100644 index 0000000000..007f086830 --- /dev/null +++ b/examples/declarative/flickr/content/RssModel.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.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/content/ScrollBar.qml b/examples/declarative/flickr/content/ScrollBar.qml new file mode 100644 index 0000000000..7d2d9ff7d3 --- /dev/null +++ b/examples/declarative/flickr/content/ScrollBar.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.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/content/Slider.qml b/examples/declarative/flickr/content/Slider.qml new file mode 100644 index 0000000000..b4a2960ac8 --- /dev/null +++ b/examples/declarative/flickr/content/Slider.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.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/content/StreamView.qml b/examples/declarative/flickr/content/StreamView.qml new file mode 100644 index 0000000000..e2c65e22fe --- /dev/null +++ b/examples/declarative/flickr/content/StreamView.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Item{ + id: container + property alias model: mp.model + property alias delegate: mp.delegate + property bool jumpStarted: false + ParticleSystem{ + id: sys + anchors.fill:parent + } + ModelParticle{ + id: mp + fade: false + system: sys + anchors.fill: parent + onModelCountChanged: { + if(!jumpStarted && modelCount > 0){ + console.log("Jumping"); + jumpStarted = true; + sys.fastForward(8000); + } + } + } + property real emitterSpacing: parent.width/3 + Emitter{ + system: sys + width: emitterSpacing - 64 + x: emitterSpacing*0 + 32 + y: -128 + height: 32 + speed: PointDirection{ y: (container.height + 128)/12 } + emitRate: 0.4 + lifeSpan: 1000000//eventually -1 should mean a million seconds for neatness + emitCap: 15 + } + Emitter{ + system: sys + width: emitterSpacing - 64 + x: emitterSpacing*1 + 32 + y: -128 + height: 32 + speed: PointDirection{ y: (container.height + 128)/12 } + emitRate: 0.4 + lifeSpan: 1000000//eventually -1 should mean a million seconds for neatness + emitCap: 15 + } + Emitter{ + system: sys + width: emitterSpacing - 64 + x: emitterSpacing*2 + 32 + y: -128 + height: 32 + speed: PointDirection{ y: (container.height + 128)/12 } + emitRate: 0.4 + lifeSpan: 1000000//eventually -1 should mean a million seconds for neatness + emitCap: 15 + } + Kill{ + system: sys + y: container.height + 64 + width: container.width + height: 6400 + } +} diff --git a/examples/declarative/flickr/content/TitleBar.qml b/examples/declarative/flickr/content/TitleBar.qml new file mode 100644 index 0000000000..381d252ed3 --- /dev/null +++ b/examples/declarative/flickr/content/TitleBar.qml @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.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/content/ToolBar.qml b/examples/declarative/flickr/content/ToolBar.qml new file mode 100644 index 0000000000..ca5341e101 --- /dev/null +++ b/examples/declarative/flickr/content/ToolBar.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.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/content/UnifiedDelegate.qml b/examples/declarative/flickr/content/UnifiedDelegate.qml new file mode 100644 index 0000000000..f4c926763f --- /dev/null +++ b/examples/declarative/flickr/content/UnifiedDelegate.qml @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Package { + 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 { + id: gridwrapper; + width: GridView.view.cellWidth; height: GridView.view.cellHeight + Package.name: "grid" + } + Item { + id: streamwrapper; + width: 80; height: 80 + Package.name: "stream" + function pleaseFreeze(){ + ModelParticle.particle.freeze(streamwrapper); + } + function pleaseUnfreeze(){ + ModelParticle.particle.unfreeze(streamwrapper); + } + } + Item { + //anchors.centerIn: parent//Doesn't animate :( + width: 80; height: 80 + scale: 0.0 + Behavior on scale { NumberAnimation { easing.type: Easing.InOutQuad} } + id: scaleMe + + Item { + id: whiteRectContainer + width: 77; height: 77; anchors.centerIn: parent + Rectangle { + id: whiteRect; width: 77; height: 77; color: "#dddddd"; smooth: true + x:0; y:0 + Image { id: thumb; source: imagePath; x: 1; y: 1; smooth: true } + Image { source: "images/gloss.png" } + MouseArea { anchors.fill: parent; onClicked: photoClicked() } + } + } + + Connections { + target: toolBar + onButton2Clicked: if (scaleMe.state == 'Details' ) scaleMe.state = 'Show' + } + + state: 'inStream' + 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" + ScriptAction{ script: streamwrapper.pleaseFreeze(); } + ParentAnimation { + via: foreground + NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } + } + }, + Transition { + from: "Details"; to: "Show" + SequentialAnimation{ + ParentAnimation { + via: foreground + NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } + } + ScriptAction{ script: streamwrapper.pleaseUnfreeze(); } + } + } + ] + Item{ + id: stateContainer + states: [ + State { + name: 'inStream' + when: screen.inGridView == false + ParentChange { + target: scaleMe; parent: streamwrapper + x: 0; y: 0; + } + }, + State { + name: 'inGrid' + when: screen.inGridView == true + ParentChange { + target: scaleMe; parent: gridwrapper + x: 0; y: 0; + } + } + ] + + transitions: [ + Transition { + ParentAnimation { + NumberAnimation { target: scaleMe; properties: 'x,y,width,height'; duration: 300 } + } + } + ] + } + } +} diff --git a/examples/declarative/flickr/content/images/gloss.png b/examples/declarative/flickr/content/images/gloss.png new file mode 100644 index 0000000000..5d370cd93d Binary files /dev/null and b/examples/declarative/flickr/content/images/gloss.png differ diff --git a/examples/declarative/flickr/content/images/lineedit.png b/examples/declarative/flickr/content/images/lineedit.png new file mode 100644 index 0000000000..2cc38dc35b Binary files /dev/null and b/examples/declarative/flickr/content/images/lineedit.png differ diff --git a/examples/declarative/flickr/content/images/lineedit.sci b/examples/declarative/flickr/content/images/lineedit.sci new file mode 100644 index 0000000000..054bff78be --- /dev/null +++ b/examples/declarative/flickr/content/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/content/images/noise.png b/examples/declarative/flickr/content/images/noise.png new file mode 100644 index 0000000000..c5a5ba0053 Binary files /dev/null and b/examples/declarative/flickr/content/images/noise.png differ diff --git a/examples/declarative/flickr/content/images/particle.png b/examples/declarative/flickr/content/images/particle.png new file mode 100644 index 0000000000..dbc39cb16e Binary files /dev/null and b/examples/declarative/flickr/content/images/particle.png differ diff --git a/examples/declarative/flickr/content/images/quit.png b/examples/declarative/flickr/content/images/quit.png new file mode 100644 index 0000000000..5bda1b6e0d Binary files /dev/null and b/examples/declarative/flickr/content/images/quit.png differ diff --git a/examples/declarative/flickr/content/images/squareParticle.png b/examples/declarative/flickr/content/images/squareParticle.png new file mode 100644 index 0000000000..faf85c24e0 Binary files /dev/null and b/examples/declarative/flickr/content/images/squareParticle.png differ diff --git a/examples/declarative/flickr/content/images/stripes.png b/examples/declarative/flickr/content/images/stripes.png new file mode 100644 index 0000000000..9f36727ea4 Binary files /dev/null and b/examples/declarative/flickr/content/images/stripes.png differ diff --git a/examples/declarative/flickr/content/images/titlebar.png b/examples/declarative/flickr/content/images/titlebar.png new file mode 100644 index 0000000000..51c90082d0 Binary files /dev/null and b/examples/declarative/flickr/content/images/titlebar.png differ diff --git a/examples/declarative/flickr/content/images/titlebar.sci b/examples/declarative/flickr/content/images/titlebar.sci new file mode 100644 index 0000000000..0418d94cd6 --- /dev/null +++ b/examples/declarative/flickr/content/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/content/images/toolbutton.png b/examples/declarative/flickr/content/images/toolbutton.png new file mode 100644 index 0000000000..11310013ee Binary files /dev/null and b/examples/declarative/flickr/content/images/toolbutton.png differ diff --git a/examples/declarative/flickr/content/images/toolbutton.sci b/examples/declarative/flickr/content/images/toolbutton.sci new file mode 100644 index 0000000000..9e4f965307 --- /dev/null +++ b/examples/declarative/flickr/content/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/flickr/content/qmldir b/examples/declarative/flickr/content/qmldir new file mode 100644 index 0000000000..adc2479b9f --- /dev/null +++ b/examples/declarative/flickr/content/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/flickr-90.qml b/examples/declarative/flickr/flickr-90.qml new file mode 100644 index 0000000000..ce22d8a3a9 --- /dev/null +++ b/examples/declarative/flickr/flickr-90.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + width: 480; height: 320 + + Loader { + y: 320; rotation: -90 + transformOrigin: Item.TopLeft + source: "flickr.qml" + } +} diff --git a/examples/declarative/flickr/flickr.qml b/examples/declarative/flickr/flickr.qml new file mode 100644 index 0000000000..a222b41341 --- /dev/null +++ b/examples/declarative/flickr/flickr.qml @@ -0,0 +1,166 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Particles 2.0 +import "content" + +Item { + id: screen; width: 320; height: 480 + property bool inGridView : false + + Rectangle { + id: background + anchors.fill: parent; color: "#343434"; + + Image { source: "content/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } + ParticleSystem { + id: bgParticles + startTime: 16000 + } + ImageParticle { + particles: ["trail"] + source: "content/images/particle.png" + color: "#1A1A6F" + alpha: 0.1 + colorVariation: 0.01 + blueVariation: 0.8 + system: bgParticles + } + Emitter { + particle: "drops" + width: parent.width + emitRate: 0.5 + lifeSpan: 20000 + speed: PointDirection{ + y: {screen.height/18} + } + system: bgParticles + } + FollowEmitter { + follow: "drops" + particle: "trail" + emitRatePerParticle: 18 + size: 32 + endSize: 0 + sizeVariation: 4 + lifeSpan: 1200 + system: bgParticles + anchors.fill: parent + emitWidth: 16 + emitHeight: 16 + emitShape: EllipseShape{} + } + + VisualDataModel{ + id: vdm + delegate: UnifiedDelegate{} + model: RssModel { id: rssModel } + } + + Item { + id: views + width: parent.width + anchors.top: titleBar.bottom; anchors.bottom: toolBar.top + + GridView { + id: photoGridView; model: vdm.parts.grid + cacheBuffer: 1000 + cellWidth: (parent.width-2)/4; cellHeight: cellWidth; width: parent.width; height: parent.height + } + + StreamView{ + id: photoStreamView + model: vdm.parts.stream + width: parent.width; height: parent.height + } + + states: State { + name: "GridView"; when: screen.inGridView == true + } + + transitions: Transition { + NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad } + } + + ImageDetails { id: imageDetails; width: parent.width; anchors.left: views.right; height: parent.height } + + Item { id: foreground; anchors.fill: parent } + } + + TitleBar { id: titleBar; width: parent.width; height: 40; opacity: 0.9 } + + 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.inGridView == true) screen.inGridView = false; else screen.inGridView = 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/flickr.qmlproject b/examples/declarative/flickr/flickr.qmlproject new file mode 100644 index 0000000000..d4909f8685 --- /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: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/minehunt/MinehuntCore/Explosion.qml b/examples/declarative/minehunt/MinehuntCore/Explosion.qml new file mode 100644 index 0000000000..a5f3f1bc31 --- /dev/null +++ b/examples/declarative/minehunt/MinehuntCore/Explosion.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/MinehuntCore/Tile.qml b/examples/declarative/minehunt/MinehuntCore/Tile.qml new file mode 100644 index 0000000000..90247f8575 --- /dev/null +++ b/examples/declarative/minehunt/MinehuntCore/Tile.qml @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/MinehuntCore/pics/back.png b/examples/declarative/minehunt/MinehuntCore/pics/back.png new file mode 100644 index 0000000000..f6b3f0b4d7 Binary files /dev/null and b/examples/declarative/minehunt/MinehuntCore/pics/back.png differ diff --git a/examples/declarative/minehunt/MinehuntCore/pics/background.png b/examples/declarative/minehunt/MinehuntCore/pics/background.png new file mode 100644 index 0000000000..3734a27744 Binary files /dev/null and b/examples/declarative/minehunt/MinehuntCore/pics/background.png differ diff --git a/examples/declarative/minehunt/MinehuntCore/pics/bomb-color.png b/examples/declarative/minehunt/MinehuntCore/pics/bomb-color.png new file mode 100644 index 0000000000..61ad0a928f Binary files /dev/null and b/examples/declarative/minehunt/MinehuntCore/pics/bomb-color.png differ diff --git a/examples/declarative/minehunt/MinehuntCore/pics/bomb.png b/examples/declarative/minehunt/MinehuntCore/pics/bomb.png new file mode 100644 index 0000000000..a992575518 Binary files /dev/null and b/examples/declarative/minehunt/MinehuntCore/pics/bomb.png differ diff --git a/examples/declarative/minehunt/MinehuntCore/pics/face-sad.png b/examples/declarative/minehunt/MinehuntCore/pics/face-sad.png new file mode 100644 index 0000000000..cf00aafe1f Binary files /dev/null and b/examples/declarative/minehunt/MinehuntCore/pics/face-sad.png differ diff --git a/examples/declarative/minehunt/MinehuntCore/pics/face-smile-big.png b/examples/declarative/minehunt/MinehuntCore/pics/face-smile-big.png new file mode 100644 index 0000000000..f9c2335df5 Binary files /dev/null and b/examples/declarative/minehunt/MinehuntCore/pics/face-smile-big.png differ diff --git a/examples/declarative/minehunt/MinehuntCore/pics/face-smile.png b/examples/declarative/minehunt/MinehuntCore/pics/face-smile.png new file mode 100644 index 0000000000..3d66d72578 Binary files /dev/null and b/examples/declarative/minehunt/MinehuntCore/pics/face-smile.png differ diff --git a/examples/declarative/minehunt/MinehuntCore/pics/flag-color.png b/examples/declarative/minehunt/MinehuntCore/pics/flag-color.png new file mode 100644 index 0000000000..aadad0f11a Binary files /dev/null and b/examples/declarative/minehunt/MinehuntCore/pics/flag-color.png differ diff --git a/examples/declarative/minehunt/MinehuntCore/pics/flag.png b/examples/declarative/minehunt/MinehuntCore/pics/flag.png new file mode 100644 index 0000000000..39cde4df82 Binary files /dev/null and b/examples/declarative/minehunt/MinehuntCore/pics/flag.png differ diff --git a/examples/declarative/minehunt/MinehuntCore/pics/front.png b/examples/declarative/minehunt/MinehuntCore/pics/front.png new file mode 100644 index 0000000000..834331bd49 Binary files /dev/null and b/examples/declarative/minehunt/MinehuntCore/pics/front.png differ diff --git a/examples/declarative/minehunt/MinehuntCore/pics/quit.png b/examples/declarative/minehunt/MinehuntCore/pics/quit.png new file mode 100644 index 0000000000..b822057d4e Binary files /dev/null and b/examples/declarative/minehunt/MinehuntCore/pics/quit.png differ diff --git a/examples/declarative/minehunt/MinehuntCore/pics/star.png b/examples/declarative/minehunt/MinehuntCore/pics/star.png new file mode 100644 index 0000000000..3772359188 Binary files /dev/null and b/examples/declarative/minehunt/MinehuntCore/pics/star.png differ diff --git a/examples/declarative/minehunt/MinehuntCore/qmldir b/examples/declarative/minehunt/MinehuntCore/qmldir new file mode 100644 index 0000000000..81980e09a6 --- /dev/null +++ b/examples/declarative/minehunt/MinehuntCore/qmldir @@ -0,0 +1,2 @@ +Explosion 1.0 Explosion.qml +Tile 1.0 Tile.qml diff --git a/examples/declarative/minehunt/README b/examples/declarative/minehunt/README new file mode 100644 index 0000000000..3849ca5fbf --- /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 0000000000..9e7ab5f120 --- /dev/null +++ b/examples/declarative/minehunt/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +#include "minehunt.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + QDeclarativeView canvas; + + qmlRegisterType(); + MinehuntGame* game = new MinehuntGame(); + +#ifdef Q_OS_SYMBIAN + canvas.setResizeMode(QDeclarativeView::SizeRootObjectToView); +#endif + canvas.engine()->rootContext()->setContextObject(game); + canvas.setSource(QString("qrc:minehunt.qml")); + QObject::connect(canvas.engine(), SIGNAL(quit()), &app, SLOT(quit())); + +#ifdef Q_OS_SYMBIAN + canvas.showFullScreen(); +#else + canvas.setGeometry(QRect(100, 100, 450, 450)); + canvas.show(); +#endif + return app.exec(); +} diff --git a/examples/declarative/minehunt/minehunt.cpp b/examples/declarative/minehunt/minehunt.cpp new file mode 100644 index 0000000000..c95f234ab3 --- /dev/null +++ b/examples/declarative/minehunt/minehunt.cpp @@ -0,0 +1,221 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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 0000000000..d4a318dab9 --- /dev/null +++ b/examples/declarative/minehunt/minehunt.h @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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 0000000000..a0220f2dc7 --- /dev/null +++ b/examples/declarative/minehunt/minehunt.pro @@ -0,0 +1,23 @@ +TEMPLATE = app +TARGET = minehunt +QT += declarative + +# Input +HEADERS += minehunt.h +SOURCES += main.cpp minehunt.cpp +RESOURCES = minehunt.qrc + +sources.files = minehunt.qml minehunt.pro MinehuntCore +sources.path = $$[QT_INSTALL_DEMOS]/qtdeclarative/declarative/minehunt +target.path = $$[QT_INSTALL_DEMOS]/qtdeclarative/declarative/minehunt + +INSTALLS = sources target + +symbian:{ + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + CONFIG += qt_demo + qmlminehuntfiles.files = MinehuntCore minehunt.qml + DEPLOYMENT += qmlminehuntfiles +} + diff --git a/examples/declarative/minehunt/minehunt.qml b/examples/declarative/minehunt/minehunt.qml new file mode 100644 index 0000000000..2129350625 --- /dev/null +++ b/examples/declarative/minehunt/minehunt.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "MinehuntCore" 1.0 + +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/minehunt/minehunt.qmlproject b/examples/declarative/minehunt/minehunt.qmlproject new file mode 100644 index 0000000000..d4909f8685 --- /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: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* 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 0000000000..fa8e27d383 --- /dev/null +++ b/examples/declarative/minehunt/minehunt.qrc @@ -0,0 +1,20 @@ + + + minehunt.qml + MinehuntCore/Explosion.qml + MinehuntCore/Tile.qml + MinehuntCore/qmldir + MinehuntCore/pics/background.png + MinehuntCore/pics/back.png + MinehuntCore/pics/bomb-color.png + MinehuntCore/pics/bomb.png + MinehuntCore/pics/face-sad.png + MinehuntCore/pics/face-smile-big.png + MinehuntCore/pics/face-smile.png + MinehuntCore/pics/flag-color.png + MinehuntCore/pics/flag.png + MinehuntCore/pics/front.png + MinehuntCore/pics/quit.png + MinehuntCore/pics/star.png + + diff --git a/examples/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml b/examples/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml new file mode 100644 index 0000000000..61005382da --- /dev/null +++ b/examples/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/PhotoViewerCore/BusyIndicator.qml b/examples/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml new file mode 100644 index 0000000000..14eb6439c0 --- /dev/null +++ b/examples/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/PhotoViewerCore/Button.qml b/examples/declarative/photoviewer/PhotoViewerCore/Button.qml new file mode 100644 index 0000000000..481bcc5a55 --- /dev/null +++ b/examples/declarative/photoviewer/PhotoViewerCore/Button.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/PhotoViewerCore/EditableButton.qml b/examples/declarative/photoviewer/PhotoViewerCore/EditableButton.qml new file mode 100644 index 0000000000..9c47310ebd --- /dev/null +++ b/examples/declarative/photoviewer/PhotoViewerCore/EditableButton.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/PhotoViewerCore/PhotoDelegate.qml b/examples/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml new file mode 100644 index 0000000000..4c1692cb08 --- /dev/null +++ b/examples/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml @@ -0,0 +1,188 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/PhotoViewerCore/ProgressBar.qml b/examples/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml new file mode 100644 index 0000000000..805eac208e --- /dev/null +++ b/examples/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/PhotoViewerCore/RssModel.qml b/examples/declarative/photoviewer/PhotoViewerCore/RssModel.qml new file mode 100644 index 0000000000..9f6c004952 --- /dev/null +++ b/examples/declarative/photoviewer/PhotoViewerCore/RssModel.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/PhotoViewerCore/Tag.qml b/examples/declarative/photoviewer/PhotoViewerCore/Tag.qml new file mode 100644 index 0000000000..486a28d960 --- /dev/null +++ b/examples/declarative/photoviewer/PhotoViewerCore/Tag.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/PhotoViewerCore/images/box-shadow.png b/examples/declarative/photoviewer/PhotoViewerCore/images/box-shadow.png new file mode 100644 index 0000000000..431af8545d Binary files /dev/null and b/examples/declarative/photoviewer/PhotoViewerCore/images/box-shadow.png differ diff --git a/examples/declarative/photoviewer/PhotoViewerCore/images/busy.png b/examples/declarative/photoviewer/PhotoViewerCore/images/busy.png new file mode 100644 index 0000000000..664c2b1491 Binary files /dev/null and b/examples/declarative/photoviewer/PhotoViewerCore/images/busy.png differ diff --git a/examples/declarative/photoviewer/PhotoViewerCore/images/cardboard.png b/examples/declarative/photoviewer/PhotoViewerCore/images/cardboard.png new file mode 100644 index 0000000000..1847ab528d Binary files /dev/null and b/examples/declarative/photoviewer/PhotoViewerCore/images/cardboard.png differ diff --git a/examples/declarative/photoviewer/PhotoViewerCore/qmldir b/examples/declarative/photoviewer/PhotoViewerCore/qmldir new file mode 100644 index 0000000000..d3c247f21a --- /dev/null +++ b/examples/declarative/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/PhotoViewerCore/script/script.js b/examples/declarative/photoviewer/PhotoViewerCore/script/script.js new file mode 100644 index 0000000000..e8ef93a847 --- /dev/null +++ b/examples/declarative/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/i18n/base.ts b/examples/declarative/photoviewer/i18n/base.ts new file mode 100644 index 0000000000..1accfd2f90 --- /dev/null +++ b/examples/declarative/photoviewer/i18n/base.ts @@ -0,0 +1,30 @@ + + + + + AlbumDelegate + + + Remove + + + + + photoviewer + + + Add + + + + + Edit + + + + + Back + + + + diff --git a/examples/declarative/photoviewer/i18n/qml_fr.qm b/examples/declarative/photoviewer/i18n/qml_fr.qm new file mode 100644 index 0000000000..c24fcbc46c Binary files /dev/null and b/examples/declarative/photoviewer/i18n/qml_fr.qm differ diff --git a/examples/declarative/photoviewer/i18n/qml_fr.ts b/examples/declarative/photoviewer/i18n/qml_fr.ts new file mode 100644 index 0000000000..9f892db616 --- /dev/null +++ b/examples/declarative/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/photoviewer.qml b/examples/declarative/photoviewer/photoviewer.qml new file mode 100644 index 0000000000..d2eaa56c1a --- /dev/null +++ b/examples/declarative/photoviewer/photoviewer.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/photoviewer/photoviewer.qmlproject b/examples/declarative/photoviewer/photoviewer.qmlproject new file mode 100644 index 0000000000..d4909f8685 --- /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: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/plasmapatrol/PlasmaPatrol.qmlproject b/examples/declarative/plasmapatrol/PlasmaPatrol.qmlproject new file mode 100644 index 0000000000..53f5ecb8d2 --- /dev/null +++ b/examples/declarative/plasmapatrol/PlasmaPatrol.qmlproject @@ -0,0 +1,18 @@ +/* File generated by QtCreator */ + +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/plasmapatrol/TODO b/examples/declarative/plasmapatrol/TODO new file mode 100644 index 0000000000..ef9d21a73d --- /dev/null +++ b/examples/declarative/plasmapatrol/TODO @@ -0,0 +1,10 @@ +Realistic Tasks: +Particle explosions on ship death. +Better help text (both content and styled a little nicer). +Hardpoint help showing them firing across the screen. +Endless Demo Mode + +Nice-but-i-doubt-it-will-get-done Tasks: +Particle Text for the winner. +Particle-based buttons. +Single player mode that is challenges (known opponents) to master the game with and earn achievements (in addition to 'skirmish'). diff --git a/examples/declarative/plasmapatrol/content/BlasterHardpoint.qml b/examples/declarative/plasmapatrol/content/BlasterHardpoint.qml new file mode 100644 index 0000000000..1242a85149 --- /dev/null +++ b/examples/declarative/plasmapatrol/content/BlasterHardpoint.qml @@ -0,0 +1,133 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Item { + id: container + property variant target: {"y": -90, "x":12} + property Item targetObj: container + property Item hardpoint: container + property ParticleSystem system + property int blasts: 16 + property int bonusBlasts: 12 + property bool show: true + + width: 24 + height: 24 + Emitter{ + id: visualization + particle: "blaster" + system: container.system + emitting: show + anchors.fill: parent + shape: EllipseShape{} + speed: TargetedDirection{ targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true} + lifeSpan: 1000 + emitRate: 64 + + size: 24 + sizeVariation: 24 + endSize: 0 + } + + property int blastsLeft: 0 + function fireAt(targetArg, container){ + target = container.mapFromItem(targetArg, targetArg.width/2, targetArg.height/2); + targetObj = targetArg; + hardpoint = container; + blastsLeft = blasts; + rofTimer.repeat = true; + rofTimer.start(); + } + Timer{ + id: rofTimer + interval: 30;//Has to be greater than 1 frame or they stack up + running: false + repeat: false + onTriggered:{ + if(targetObj.hp <= 0) + return; + //TODO: calculate hit and damage at target, which must be a Ship + var hit; + if(blastsLeft >= bonusBlasts) + hit = Math.random() > targetObj.dodge; + else + hit = false; //purely aesthetic shots, because the damage isn't that fine grained + if(hit == true){ + switch(targetObj.shipType){ + case 1: hardpoint.damageDealt += 4; break; + case 2: hardpoint.damageDealt += 5; break; + case 3: hardpoint.damageDealt += 1; break; + default: hardpoint.damageDealt += 100; + } + } + blastVector.targetX = target.x; + blastVector.targetY = target.y; + if(!hit){//TODO: Actual targetVariation + blastVector.targetX += (128 * Math.random() - 64); + blastVector.targetY += (128 * Math.random() - 64); + } + emitter.burst(1); + blastsLeft--; + if(!blastsLeft) + rofTimer.repeat = false; + } + } + Emitter{ + id: emitter + particle: "blaster" + emitting: false + system: container.system + anchors.centerIn: parent + + lifeSpan: 1000 + emitRate: 16 + emitCap: blasts + size: 24 + endSize:16 + sizeVariation: 8 + speed: TargetedDirection{ + id: blastVector + targetX: target.x; targetY: target.y; magnitude: 1.1; proportionalMagnitude: true + } + } +} diff --git a/examples/declarative/plasmapatrol/content/Button.qml b/examples/declarative/plasmapatrol/content/Button.qml new file mode 100644 index 0000000000..0d810e3b75 --- /dev/null +++ b/examples/declarative/plasmapatrol/content/Button.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 + +//TODO: Add particles to this component too +Rectangle{ + id: container + property alias text: txt.text + signal clicked + //color: "lightsteelblue" + gradient: Gradient{ + GradientStop{ position: 0.0; color: "lightsteelblue" } + GradientStop{ position: 1.0; color: "steelblue" } + } + height: 64 + radius: 16 + width: 128 + Text{ + id: txt + anchors.centerIn: parent + font.pixelSize: 24 + color: "white" + } + MouseArea{ + anchors.fill: parent + onClicked: container.clicked() + } +} diff --git a/examples/declarative/plasmapatrol/content/CannonHardpoint.qml b/examples/declarative/plasmapatrol/content/CannonHardpoint.qml new file mode 100644 index 0000000000..b7572ef5c4 --- /dev/null +++ b/examples/declarative/plasmapatrol/content/CannonHardpoint.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Item { + id: container + property variant target: {"y": -90, "x":12} + property ParticleSystem system + property bool show: true + + width: 24 + height: 24 + Emitter{ + id: visualization + particle: "cannon" + emitting: container.show + system: container.system + anchors.centerIn: parent + lifeSpan: 2000 + emitRate: 1 + + size: 4 + endSize: 0 + } + + function fireAt(targetArg, hardpoint){ + target = container.mapFromItem(targetArg, targetArg.width/2, targetArg.height/2); + if(container.hp <= 0 || targetArg.hp <= 0) + return; + //TODO: calculate hit and damage at target, which must be a Ship + var hit = Math.random() > targetArg.dodge + if(hit){ + switch(targetArg.shipType){ + case 1: hardpoint.damageDealt += 8; break; + case 2: hardpoint.damageDealt += 10; break; + case 3: hardpoint.damageDealt += 16; break; + default: hardpoint.damageDealt += 1000; + } + } + emitter.burst(1); + } + Emitter{ + id: emitter + particle: "cannon" + emitting: false + system: container.system + anchors.centerIn: parent + + lifeSpan: 1000 + emitRate: 1 + size: 8 + endSize: 4 + speed: TargetedDirection{ + id: blastVector + targetX: target.x; targetY: target.y; magnitude: 1.1; proportionalMagnitude: true + } + } +} diff --git a/examples/declarative/plasmapatrol/content/ChoiceBox.qml b/examples/declarative/plasmapatrol/content/ChoiceBox.qml new file mode 100644 index 0000000000..1e64a76225 --- /dev/null +++ b/examples/declarative/plasmapatrol/content/ChoiceBox.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Item{ + id: container + width: 360 + height: 160 + property ParticleSystem system + Ship{ + id: nully + system: system + } + property Item target: nully + /* + Component.onCompleted:{ + container.target.shipType = 1 + container.target.gunType = 1 + } + */ + Row{ + anchors.horizontalCenter: parent.horizontalCenter + height: parent.height + spacing: 8 + Button{ + width: 80 + height: 80 + anchors.verticalCenter: parent.verticalCenter + text: "Cycle\nShip" + onClicked: { + var nextVal = container.target.shipType; + if(nextVal == 3) + nextVal = 1; + else + nextVal++; + container.target.shipType = nextVal; + } + } + Item{ + width: 128 + height: 128 + anchors.verticalCenter: parent.verticalCenter + Ship{ + hp: 20 + anchors.centerIn: parent + shipType: container.target.shipType + gunType: container.target.gunType + system: container.system + } + } + Button{ + width: 80 + height: 80 + anchors.verticalCenter: parent.verticalCenter + text: "Cycle\nGun" + onClicked: { + var nextVal = container.target.gunType; + if(nextVal == 3) + nextVal = 1; + else + nextVal++; + container.target.gunType = nextVal; + } + } + } +} diff --git a/examples/declarative/plasmapatrol/content/Cruiser.qml b/examples/declarative/plasmapatrol/content/Cruiser.qml new file mode 100644 index 0000000000..a844fa1bb8 --- /dev/null +++ b/examples/declarative/plasmapatrol/content/Cruiser.qml @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Item { + id: container + property int maxHP: 100 + property int hp: maxHP + property real initialDodge: 0.01 + property real dodge: initialDodge + onHpChanged: if(hp <= 0) target = container; + property ParticleSystem system//TODO: Ship abstraction + property Item target: container + property string shipParticle: "default"//Per team colors? + property int gunType: 0 + width: 128 + height: 128 + Emitter{ + //TODO: Cooler would be an 'orbiting' affector + //TODO: On the subject, opacity and size should be grouped type 'overLife' if we can cram that in the particles + system: container.system + particle: container.shipParticle + anchors.centerIn: parent + width: 64 + height: 64 + shape: EllipseShape{} + + emitRate: hp > 0 ? hp * 1 + 20 : 0 + lifeSpan: 2400 + emitCap: (maxHP * 1 + 20)*2.4 + + size: 48 + sizeVariation: 16 + endSize: 16 + + speed: AngledDirection{angleVariation:360; magnitudeVariation: 32} + } + Emitter{ + system: container.system + particle: "cruiserArmor" + anchors.fill: parent + shape: EllipseShape{ fill: false } + emitting: hp>0 + + emitRate: 16 + lifeSpan: 2000 + + size: 48 + sizeVariation: 24 + + SpriteGoal{ + id: destructor + system: container.system + active: container.hp <=0 + anchors.fill: parent + particles: ["cruiserArmor"] + goalState: "death" +// jump: true + onceOff: true + } + } + + Timer{ + id: fireControl + property int next: Math.floor(Math.random() * 3) + 1 + interval: 800 + running: root.readySetGo + repeat: true + onTriggered:{ + if(next == 1){ + gun1.fireAt(container.target); + next = Math.floor(Math.random() * 3) + 1; + }else if(next == 2){ + gun2.fireAt(container.target); + next = Math.floor(Math.random() * 3) + 1; + }else if(next == 3){ + gun3.fireAt(container.target); + next = Math.floor(Math.random() * 3) + 1; + } + } + } + + Hardpoint{//TODO: Hardpoint abstraction + x: 112 - 12 - 8*2 + y: 128 - 12 - 12*2 + id: gun1 + system: container.system + show: hp > 0 + hardpointType: gunType + } + Hardpoint{ + x: 64 - 12 + y: 0 - 12 + 12*2 + id: gun2 + system: container.system + show: hp > 0 + hardpointType: gunType + } + Hardpoint{ + x: 16 - 12 + 8*2 + y: 128 - 12 - 12*2 + id: gun3 + system: container.system + show: hp > 0 + hardpointType: gunType + } +} diff --git a/examples/declarative/plasmapatrol/content/Frigate.qml b/examples/declarative/plasmapatrol/content/Frigate.qml new file mode 100644 index 0000000000..d31405250e --- /dev/null +++ b/examples/declarative/plasmapatrol/content/Frigate.qml @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Item { + id: container + property int maxHP: 100 + property int hp: maxHP + property real initialDodge: 0.2 + property real dodge: initialDodge + onHpChanged: if(hp <= 0) target = container; + property ParticleSystem system//TODO: Ship abstraction + property Item target: container + property string shipParticle: "default"//Per team colors? + property int gunType: 0 + width: 128 + height: 128 + Emitter{ + system: container.system + particle: "frigateShield" + anchors.centerIn: parent + size: 92 + emitRate: 1 + lifeSpan: 4800 + emitting: hp > 0 + } + Emitter{ + system: container.system + particle: container.shipParticle + anchors.centerIn: parent + width: 64 + height: 16 + shape: EllipseShape{} + + size: 16 + sizeVariation: 8 + endSize: 8 + emitRate: hp > 0 ? hp * 1 + 20 : 0 + lifeSpan: 1200 + emitCap: (maxHP * 1 + 20)*2 + } + Timer{ + id: fireControl + property int next: Math.floor(Math.random() * 2) + 1 + interval: 800 + running: root.readySetGo + repeat: true + onTriggered:{ + if(next == 1){ + gun1.fireAt(container.target); + next = Math.floor(Math.random() * 2) + 1; + }else if(next == 2){ + gun2.fireAt(container.target); + next = Math.floor(Math.random() * 2) + 1; + } + } + } + + Hardpoint{ + x: 128 - 32 - 12 + y: 64 - 12 + id: gun1 + system: container.system + show: hp > 0 + hardpointType: gunType + } + Hardpoint{ + x: 0 + 32 - 12 + y: 64 - 12 + id: gun2 + system: container.system + show: hp > 0 + hardpointType: gunType + } +} diff --git a/examples/declarative/plasmapatrol/content/Hardpoint.qml b/examples/declarative/plasmapatrol/content/Hardpoint.qml new file mode 100644 index 0000000000..3d4edb38f8 --- /dev/null +++ b/examples/declarative/plasmapatrol/content/Hardpoint.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Item { + id: container + //ReflectiveProperties + //TransferredProperties + property variant target: {"y": -90, "x":12} + property ParticleSystem system + property bool show: true + property int hardpointType: 0 //default is pea shooter - always bad. + + property Item targetObj: null + property int damageDealt: 0 + onDamageDealtChanged: dealDamageTimer.start(); + Timer{ + id: dealDamageTimer + interval: 16 + running: false + repeat: false + onTriggered: {targetObj.hp -= damageDealt; damageDealt = 0;} + } + width: 24 + height: 24 + function fireAt(targetArg){//Each implement own + if(targetArg != null){ + hardpointLoader.item.fireAt(targetArg, container); + targetObj = targetArg; + } + } + Loader{ + id: hardpointLoader + sourceComponent: {switch(hardpointType){ + case 1: laserComponent; break; + case 2: blasterComponent; break; + case 3: cannonComponent; break; + default: emptyComponent; + }} + } + Component{ + id: laserComponent + LaserHardpoint{ + target: container.target + system: container.system + show: container.show + } + } + Component{ + id: blasterComponent + BlasterHardpoint{ + target: container.target + system: container.system + show: container.show + } + } + Component{ + id: cannonComponent + CannonHardpoint{ + target: container.target + system: container.system + show: container.show + } + } + Component{ + id: emptyComponent + Item { + function fireAt(obj){ + console.log("Firing null weapon. It hurts."); + } + } + } +} diff --git a/examples/declarative/plasmapatrol/content/HelpScreens.qml b/examples/declarative/plasmapatrol/content/HelpScreens.qml new file mode 100644 index 0000000000..7e4fb9f1c9 --- /dev/null +++ b/examples/declarative/plasmapatrol/content/HelpScreens.qml @@ -0,0 +1,268 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +SequentialLoader { + id: hLdr + signal exitDesired + Component.onCompleted: advance(); + ParticleSystem{ id: helpSystem } + PlasmaPatrolParticles{ sys: helpSystem } + pages: [ + Component{Item{ + id: story + Text{ + color: "white" + text: "Story" + font.pixelSize: 48 + } + /* + Flickable{ + y: 60 + width: 360 + height: 500 + contentHeight: txt1.height + contentWidth: 360//TODO: Less magic numbers? + */ + Text{ + id: txt1 + color: "white" + y: 60 + font.pixelSize: 18 + text: " +In a remote nebula, a race of energy beings formed and lived prosperous lives for millenia. Until the schism - when they became constantly at each other's energy-throats. War soon followed, crippling both sides, until a truce was formed. But while governments knew the desparate need for peace, the soldiers in the ion-field were still filled with rampant bloodlust. On the border, patrols are constantly engaging in minor skirmishes whenever they cross paths. + +You must select one such patrol unit for the border, heading into an inevitable skirmish, in Plasma Patrol: the game of energy being spaceship combat! + " + width: 360 + wrapMode: Text.WordWrap + } + // } + Button{ + x: 20 + y: 560 + height: 40 + width: 120 + text: "Next" + onClicked: hLdr.advance(); + } + Button{ + x: 220 + y: 560 + height: 40 + width: 120 + text: "Menu" + onClicked: hLdr.exitDesired(); + } + }}, + Component{Item{ + id: ships + Text{ + color: "white" + text: "Vessels" + font.pixelSize: 48 + } + Column{ + spacing: 16 + y: 60 + Row{ + height: 128 + Sloop{ + system: helpSystem + } + Text{ + text: "The nimble sloop" + color: "white" + font.pixelSize: 18 + } + } + Row{ + height: 128 + Frigate{ + system: helpSystem + } + Text{ + text: "The versitile shield frigate" + color: "white" + font.pixelSize: 18 + } + } + Row{ + height: 128 + Cruiser{ + system: helpSystem + } + Text{ + text: "The armored cruiser" + color: "white" + font.pixelSize: 18 + } + } + } + Button{ + x: 20 + y: 560 + height: 40 + width: 120 + text: "Next" + onClicked: hLdr.advance(); + } + Button{ + x: 220 + y: 560 + height: 40 + width: 120 + text: "Menu" + onClicked: hLdr.exitDesired(); + } + }}, + Component{Item{ + id: guns + Text{ + color: "white" + text: "Hardpoints" + font.pixelSize: 48 + } + Column{ + spacing: 16 + y: 60 + Row{ + height: 128 + LaserHardpoint{ + system: helpSystem + } + Text{ + text: "The laser hardpoint almost always hits the target, even the nimble sloop, but loses much of its potency against the frigate's shields" + width: 332 + wrapMode: Text.WordWrap + color: "white" + font.pixelSize: 18 + } + } + Row{ + height: 128 + BlasterHardpoint{ + system: helpSystem + } + Text{ + text: "The blaster passes right through the frigate's shields but loses much of its impact against the armor of the cruiser" + width: 332 + wrapMode: Text.WordWrap + color: "white" + font.pixelSize: 18 + } + } + Row{ + height: 128 + CannonHardpoint{ + system: helpSystem + } + Text{ + text: "The cannon has poor accuracy, often missing the nimble sloop, but can punch right through the armor of the cruiser" + width: 332 + wrapMode: Text.WordWrap + color: "white" + font.pixelSize: 18 + } + } + } + Button{ + x: 20 + y: 560 + height: 40 + width: 120 + text: "Next" + onClicked: hLdr.advance(); + } + Button{ + x: 220 + y: 560 + height: 40 + width: 120 + text: "Menu" + onClicked: hLdr.exitDesired(); + } + }}, + Component{Item{ + id: strategy + Text{ + color: "white" + text: "Strategy" + font.pixelSize: 48 + } + Flickable{ + y: 60 + width: 360 + height: 500 + contentHeight: txt1.height + contentWidth: 360//TODO: Less magic numbers? + Text{ + id: txt1 + color: "white" + font.pixelSize: 18 + text: " +Basic Strategy: Good luck, have fun - don't die. +More to come after thorough playtesting. + " + width: 360 + wrapMode: Text.WordWrap + } + } + Button{ + x: 20 + y: 560 + height: 40 + width: 120 + text: "Story" + onClicked: {hLdr.at=0; hLdr.advance();} + } + Button{ + x: 220 + y: 560 + height: 40 + width: 120 + text: "Menu" + onClicked: hLdr.exitDesired(); + } + }} + ] +} diff --git a/examples/declarative/plasmapatrol/content/LaserHardpoint.qml b/examples/declarative/plasmapatrol/content/LaserHardpoint.qml new file mode 100644 index 0000000000..e99424856c --- /dev/null +++ b/examples/declarative/plasmapatrol/content/LaserHardpoint.qml @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Item { + id: container + property variant target: {"y": -90, "x":12} + property ParticleSystem system + property bool show: true + + width: 24 + height: 24 + Emitter{ + id: visualization + particle: "laser" + system: container.system + anchors.fill: parent + emitting: container.show + shape: EllipseShape{} + speed: TargetedDirection{ targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true } + lifeSpan: 1000 + emitRate: 64 + + size: 24 + sizeVariation: 8 + endSize: 8 + } + + function fireAt(targetArg, hardpoint){ + if(targetArg.hp <= 0) + return; + //TODO: calculate hit and damage at target, which must be a Ship + var offset = 0; + if(Math.random() < 0.99){ + switch(targetArg.shipType){ + case 1: hardpoint.damageDealt += 16; break; + case 2: hardpoint.damageDealt += 4; break; + case 3: hardpoint.damageDealt += 8; break; + default: hardpoint.damageDealt += 500; //Really effective against unregistered vessels + } + }else{//Misses with Lasers are really rare + offset = Math.random() * 100; + } + target = container.mapFromItem(targetArg, offset + targetArg.width/2, offset + targetArg.height/2); + emitter.pulse(0.10); + // console.log("Fire box: " + Math.min(container.width/2, target.x) + "," + Math.min(container.height/2, target.y) + " " + (Math.max(container.width/2, target.x) - Math.min(container.width/2, target.x)) + "," + (Math.max(container.height/2, target.y) - Math.min(container.height/2, target.y))); + } + Emitter{ + id: emitter + particle: "laser" + emitting: false + system: container.system + x: Math.min(container.width/2, target.x); + width: Math.max(container.width/2, target.x) - x; + y: Math.min(container.height/2, target.y); + height: Math.max(container.height/2, target.y) - y; + shape: LineShape{ + mirrored: (emitter.y < 0 || emitter.x < 0) && !(emitter.y < 0 && emitter.x < 0 )//I just want XOR + } + + lifeSpan: 1000 + emitRate: 8000 + emitCap: 800 + size: 16 + endSize: 0 + + speed: PointDirection{xVariation: 4; yVariation: 4} + } +} diff --git a/examples/declarative/plasmapatrol/content/PlasmaPatrolParticles.qml b/examples/declarative/plasmapatrol/content/PlasmaPatrolParticles.qml new file mode 100644 index 0000000000..b65686e59e --- /dev/null +++ b/examples/declarative/plasmapatrol/content/PlasmaPatrolParticles.qml @@ -0,0 +1,173 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Item{ + property ParticleSystem sys + ImageParticle{ + system: sys + particles: ["default"] + source: "pics/blur-circle3.png" + color: "#003A3A3A" + colorVariation: 0.1 + z: 0 + } + ImageParticle{ + system: sys + particles: ["redTeam"] + source: "pics/blur-circle3.png" + color: "#0028060A" + colorVariation: 0.1 + z: 0 + } + ImageParticle{ + system: sys + particles: ["greenTeam"] + source: "pics/blur-circle3.png" + color: "#0006280A" + colorVariation: 0.1 + z: 0 + } + ImageParticle{ + system: sys + particles: ["blaster"] + source: "pics/star2.png" + //color: "#0F282406" + color: "#0F484416" + colorVariation: 0.2 + z: 2 + } + ImageParticle{ + system: sys + particles: ["laser"] + source: "pics/star3.png" + //color: "#00123F68" + color: "#00428FF8" + colorVariation: 0.2 + z: 2 + } + ImageParticle{ + system: sys + particles: ["cannon"] + source: "pics/particle.png" + color: "#80FFAAFF" + colorVariation: 0.1 + z: 2 + } + ImageParticle{ + system: sys + particles: ["cannonCore"] + source: "pics/particle.png" + color: "#00666666" + colorVariation: 0.8 + z: 1 + } + ImageParticle{ + system: sys + particles: ["cannonWake"] + source: "pics/star.png" + color: "#00CCCCCC" + colorVariation: 0.2 + z: 1 + } + ImageParticle{ + system: sys + particles: ["frigateShield"] + source: "pics/blur-circle2.png" + color: "#00000000" + colorVariation: 0.05 + blueVariation: 0.5 + greenVariation: 0.1 + z: 3 + } + ImageParticle{ + system: sys + particles: ["cruiserArmor"] + z: 1 + sprites:[Sprite{ + id: spinState + name: "spinning" + source: "pics/meteor.png" + frames: 35 + duration: 40 + to: {"death":0, "spinning":1} + },Sprite{ + name: "death" + source: "pics/meteor_explo.png" + frames: 22 + duration: 40 + to: {"null":1} + }, Sprite{ + name: "null" + source: "pics/nullRock.png" + frames: 1 + duration: 1000 + } + ] + } + FollowEmitter{ + system: sys + particle: "cannonWake" + follow: "cannon" + emitRatePerParticle: 64 + lifeSpan: 600 + speed: AngledDirection{ angleVariation: 360; magnitude: 48} + size: 16 + endSize: 8 + sizeVariation: 2 + emitting: true + width: 1000//XXX: Terrible hack + height: 1000 + } + FollowEmitter{ + system: sys + particle: "cannonCore" + follow: "cannon" + emitRatePerParticle: 256 + lifeSpan: 128 + size: 24 + endSize: 8 + emitting: true + width: 1000//XXX: Terrible hack + height: 1000 + } +} diff --git a/examples/declarative/plasmapatrol/content/SequentialLoader.qml b/examples/declarative/plasmapatrol/content/SequentialLoader.qml new file mode 100644 index 0000000000..85a979b222 --- /dev/null +++ b/examples/declarative/plasmapatrol/content/SequentialLoader.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 + +Item{ + id: container + //TODO: Somehow get particles into this? + property list pages + property Item cur: null + property int at: 0 + function advance(){ + if(cur != null) + cur.destroy(); + cur = pages[at++].createObject(container); + } +} diff --git a/examples/declarative/plasmapatrol/content/Ship.qml b/examples/declarative/plasmapatrol/content/Ship.qml new file mode 100644 index 0000000000..ce8fb6073f --- /dev/null +++ b/examples/declarative/plasmapatrol/content/Ship.qml @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Item { + id: me + //Reflective Properties + width: shipLoader.width + height: shipLoader.height + //Transfered Properties + property int hp: 100//shipLoader.item.maxHP + property real dodge: shipLoader.item.initialDodge + property ParticleSystem system + property int targetIdx: 0 + property Item target: targets[targetIdx] == undefined?null:targets[targetIdx] + Connections{ + target: me.target + onHpChanged: if(me.target.hp<=0) me.targetIdx++; + } + property list targets + property string shipParticle: "default"//Per team colors? + property int gunType: 0 + property int shipType: 0 + Component{ + id: sloopComp + Sloop{ + system: me.system + target: me.target + shipParticle: me.shipParticle + gunType: me.gunType + hp: me.hp + dodge: me.dodge + } + } + Component{ + id: frigateComp + Frigate{ + system: me.system + target: me.target + shipParticle: me.shipParticle + gunType: me.gunType + hp: me.hp + dodge: me.dodge + } + } + Component{ + id: cruiserComp + Cruiser{ + system: me.system + target: me.target + shipParticle: me.shipParticle + gunType: me.gunType + hp: me.hp + dodge: me.dodge + } + } + Component{ + id: dumbComp + Item{ + property int maxHP: 0 + property int initialDodge: 0 + } + } + Loader{ + id: shipLoader + sourceComponent:{ switch(shipType){ + case 1: sloopComp; break; + case 2: frigateComp; break; + case 3: cruiserComp; break; + default: dumbComp; + } + } + } +} diff --git a/examples/declarative/plasmapatrol/content/Sloop.qml b/examples/declarative/plasmapatrol/content/Sloop.qml new file mode 100644 index 0000000000..1a6f3a9620 --- /dev/null +++ b/examples/declarative/plasmapatrol/content/Sloop.qml @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Item { + id: container + property int maxHP: 100 + property int hp: maxHP + property real initialDodge: 0.5 + property real dodge: initialDodge + property int blinkInterval: 800 + onHpChanged: if(hp <= 0) target = container; + property ParticleSystem system//TODO: Ship abstraction + property Item target: container + property string shipParticle: "default"//Per team colors? + property int gunType: 0 + width: 128 + height: 128 + Emitter{ + id: emitter + //TODO: Cooler would be an 'orbiting' affector + //TODO: On the subject, opacity and size should be grouped type 'overLife' if we can cram that in the particles + system: container.system + particle: container.shipParticle + shape: EllipseShape{} + + emitRate: hp > 0 ? hp + 20 : 0 + lifeSpan: blinkInterval + emitCap: (maxHP + 20) + + acceleration: AngledDirection{angleVariation: 360; magnitude: 8} + + size: 24 + endSize: 4 + sizeVariation: 8 + width: 16 + height: 16 + x: 64 + y: 64 + Behavior on x{NumberAnimation{duration:blinkInterval}} + Behavior on y{NumberAnimation{duration:blinkInterval}} + Timer{ + interval: blinkInterval + running: true + repeat: true + onTriggered: { + emitter.x = Math.random() * 48 + 32 + emitter.y = Math.random() * 48 + 32 + } + } + } + Hardpoint{ + anchors.centerIn: parent + id: gun2 + system: container.system + show: container.hp > 0 + hardpointType: gunType + } + Timer{ + id: fireControl + interval: 800 + running: root.readySetGo + repeat: true + onTriggered:{ + gun2.fireAt(container.target); + } + } + +} diff --git a/examples/declarative/plasmapatrol/content/pics/TitleText.png b/examples/declarative/plasmapatrol/content/pics/TitleText.png new file mode 100644 index 0000000000..dc3acebe39 Binary files /dev/null and b/examples/declarative/plasmapatrol/content/pics/TitleText.png differ diff --git a/examples/declarative/plasmapatrol/content/pics/blur-circle2.png b/examples/declarative/plasmapatrol/content/pics/blur-circle2.png new file mode 100644 index 0000000000..f7c9f3e98e Binary files /dev/null and b/examples/declarative/plasmapatrol/content/pics/blur-circle2.png differ diff --git a/examples/declarative/plasmapatrol/content/pics/blur-circle3.png b/examples/declarative/plasmapatrol/content/pics/blur-circle3.png new file mode 100644 index 0000000000..dbc39cb16e Binary files /dev/null and b/examples/declarative/plasmapatrol/content/pics/blur-circle3.png differ diff --git a/examples/declarative/plasmapatrol/content/pics/finalfrontier.png b/examples/declarative/plasmapatrol/content/pics/finalfrontier.png new file mode 100644 index 0000000000..2ba1815230 Binary files /dev/null and b/examples/declarative/plasmapatrol/content/pics/finalfrontier.png differ diff --git a/examples/declarative/plasmapatrol/content/pics/meteor.png b/examples/declarative/plasmapatrol/content/pics/meteor.png new file mode 100644 index 0000000000..e8c368aea7 Binary files /dev/null and b/examples/declarative/plasmapatrol/content/pics/meteor.png differ diff --git a/examples/declarative/plasmapatrol/content/pics/meteor_explo.png b/examples/declarative/plasmapatrol/content/pics/meteor_explo.png new file mode 100644 index 0000000000..4297245d49 Binary files /dev/null and b/examples/declarative/plasmapatrol/content/pics/meteor_explo.png differ diff --git a/examples/declarative/plasmapatrol/content/pics/nullRock.png b/examples/declarative/plasmapatrol/content/pics/nullRock.png new file mode 100644 index 0000000000..4076327a1a Binary files /dev/null and b/examples/declarative/plasmapatrol/content/pics/nullRock.png differ diff --git a/examples/declarative/plasmapatrol/content/pics/particle.png b/examples/declarative/plasmapatrol/content/pics/particle.png new file mode 100644 index 0000000000..5c83896d22 Binary files /dev/null and b/examples/declarative/plasmapatrol/content/pics/particle.png differ diff --git a/examples/declarative/plasmapatrol/content/pics/star.png b/examples/declarative/plasmapatrol/content/pics/star.png new file mode 100644 index 0000000000..0d592cfa87 Binary files /dev/null and b/examples/declarative/plasmapatrol/content/pics/star.png differ diff --git a/examples/declarative/plasmapatrol/content/pics/star2.png b/examples/declarative/plasmapatrol/content/pics/star2.png new file mode 100644 index 0000000000..bb55c44788 Binary files /dev/null and b/examples/declarative/plasmapatrol/content/pics/star2.png differ diff --git a/examples/declarative/plasmapatrol/content/pics/star3.png b/examples/declarative/plasmapatrol/content/pics/star3.png new file mode 100644 index 0000000000..636a25f480 Binary files /dev/null and b/examples/declarative/plasmapatrol/content/pics/star3.png differ diff --git a/examples/declarative/plasmapatrol/plasmapatrol.qml b/examples/declarative/plasmapatrol/plasmapatrol.qml new file mode 100644 index 0000000000..dfc36ded01 --- /dev/null +++ b/examples/declarative/plasmapatrol/plasmapatrol.qml @@ -0,0 +1,386 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtQuick.Particles 2.0 +import "content" + +Rectangle { + id: root + property bool readySetGo: false + //Debugging + property int hits: 0 + property int misses: 0 + property real ratio: hits/(misses?misses:1) + //Move to JS file? + property Ship redVar1: Ship{shipType: 1; gunType: 1} + property Ship redVar2: Ship{shipType: 1; gunType: 2} + property Ship redVar3: Ship{shipType: 1; gunType: 3} + property Ship greenVar1: Ship{shipType: 3; gunType: 1} + property Ship greenVar2: Ship{shipType: 2; gunType: 2} + property Ship greenVar3: Ship{shipType: 1; gunType: 3} + property string winner: "0" + property int players: 0 + function aiSet(ship){ + ship.gunType = Math.floor(Math.random() * 3) + 1 + ship.shipType = Math.floor(Math.random() * 3) + 1 + } + + width: 360 + height: 600 + color: "black" + SequentialLoader{ + anchors.fill: parent + //General Children + Image{ + anchors.centerIn: parent + source: "content/pics/finalfrontier.png" + } + ParticleSystem{ + id: particles + } + PlasmaPatrolParticles{ sys: particles; z: 100 }//Renders all particles on the one plane + //Component parts + id: pageControl + Component.onCompleted: advance(); + pages:[ + Component{Item{ + id: menu + width: root.width + height: root.height + Column{ + anchors.verticalCenter: parent.verticalCenter + width: parent.width + spacing: 8 + Item{ + id: title + width: root.width + height: 240 + Emitter{ + anchors.fill: parent + system: particles + emitting: true + particle: "default" + emitRate: 1200 + lifeSpan: 1200 + shape: MaskShape{source:"content/pics/TitleText.png"} + size: 16 + endSize: 0 + sizeVariation: 8 + speed: AngledDirection{angleVariation:360; magnitudeVariation: 6} + } + } + Button{ + text: "1P" + onClicked: {root.players = 1; pageControl.advance();} + anchors.horizontalCenter: parent.horizontalCenter + } + Button{ + text: "2P" + onClicked: {root.players = 2; pageControl.advance();} + anchors.horizontalCenter: parent.horizontalCenter + } + Button{ + text: "Demo" + anchors.horizontalCenter: parent.horizontalCenter + onClicked: {root.players = 0; + aiSet(redVar1); + aiSet(redVar2); + aiSet(redVar3); + aiSet(greenVar1); + aiSet(greenVar2); + aiSet(greenVar3); + pageControl.at = 5;//TODO: Not a magic number + pageControl.advance();} + } + Button{ + text: "Help" + anchors.horizontalCenter: parent.horizontalCenter + onClicked: { + pageControl.at = 7;//TODO: Not a magic number + pageControl.advance(); + } + } + Button{ + text: "Quit" + anchors.horizontalCenter: parent.horizontalCenter + onClicked: Qt.quit(); + } + } + }}, + Component{Item{ + id: p1Screen + z: 101 + width: root.width + height: root.height + Rectangle{ + anchors.fill: parent + color: "red" + } + Text{ + anchors.centerIn: parent + color: "white" + font.pixelSize: 64 + font.bold: true + text: "Player\n 1" + horizontalAlignment: Text.AlignHCenter + } + MouseArea{ + anchors.fill: parent + onClicked: pageControl.advance() + } + }}, + Component{Item{ + id: p1Choices + z: 3 + width: root.width + height: root.height + Rectangle{ + color: "black" + anchors.fill: parent + } + Column{ + spacing: 16 + width: root.width + anchors.horizontalCenter: parent.horizontalCenter + ChoiceBox{ + target: redVar1 + system: particles + } + ChoiceBox{ + target: redVar2 + system: particles + } + ChoiceBox{ + target: redVar3 + system: particles + } + Button{ + anchors.horizontalCenter: parent.horizontalCenter + text: "Next" + onClicked: { + if(root.players < 2){ + aiSet(greenVar1); + aiSet(greenVar2); + aiSet(greenVar3); + pageControl.at = 5;//TODO: Not a magic number + } + pageControl.advance(); + } + } + } + }}, + Component{Item{ + id: p2Screen + z: 101 + width: root.width + height: root.height + Rectangle{ + anchors.fill: parent + color: "green" + } + Text{ + anchors.centerIn: parent + color: "white" + font.pixelSize: 64 + font.bold: true + text: "Player\n 2" + horizontalAlignment: Text.AlignHCenter + } + MouseArea{ + anchors.fill: parent + onClicked: pageControl.advance() + } + }}, + Component{Item{ + id: p2Choices + z: 1 + width: root.width + height: root.height + Rectangle{ + color: "black" + anchors.fill: parent + } + Column{ + spacing: 16 + width: root.width + anchors.horizontalCenter: parent.horizontalCenter + ChoiceBox{ + target: greenVar1 + system: particles + } + ChoiceBox{ + target: greenVar2 + system: particles + } + ChoiceBox{ + target: greenVar3 + system: particles + } + Button{ + anchors.horizontalCenter: parent.horizontalCenter + text: "Next" + onClicked: pageControl.advance() + } + } + }}, + Component{Item{ + id: arena + width: root.width + height: root.height + z: 0 + Component.onCompleted: root.readySetGo = true + Component.onDestruction: root.readySetGo = false + property bool victory: redShip3.hp <= 0 || greenShip3.hp <=0 + onVictoryChanged: { + if(redShip3.hp <= 0){ + if(greenShip3.hp <= 0){ + root.winner = "1&2" + }else{ + root.winner = "2" + } + }else{ + root.winner = "1" + } + winTimer.start() + } + Timer{ + id: winTimer + interval: 1200 + repeat: false + running: false + onTriggered: pageControl.advance(); + } + Ship{ + id: redShip1 + shipParticle: "redTeam" + system: particles + x: 180-64 + y: 128 + shipType: redVar1.shipType + gunType: redVar1.gunType + targets: [greenShip1, greenShip2, greenShip3] + } + Ship{ + id: redShip2 + shipParticle: "redTeam" + system: particles + x: 0 + y: 0 + shipType: redVar2.shipType + gunType: redVar2.gunType + targets: [greenShip1, greenShip2, greenShip3] + } + Ship{ + id: redShip3 + shipParticle: "redTeam" + system: particles + x: 360-128 + y: 0 + shipType: redVar3.shipType + gunType: redVar3.gunType + targets: [greenShip1, greenShip2, greenShip3] + } + + Ship{ + id: greenShip1 + shipParticle: "greenTeam" + system: particles + x: 180-64 + y: 600 - 128 - 128 + shipType: greenVar1.shipType + gunType: greenVar1.gunType + targets: [redShip1, redShip2, redShip3] + } + Ship{ + id: greenShip2 + shipParticle: "greenTeam" + system: particles + x: 0 + y: 600-128 + shipType: greenVar2.shipType + gunType: greenVar2.gunType + targets: [redShip1, redShip2, redShip3] + } + Ship{ + id: greenShip3 + shipParticle: "greenTeam" + system: particles + x: 360 - 128 + y: 600 - 128 + shipType: greenVar3.shipType + gunType: greenVar3.gunType + targets: [redShip1, redShip2, redShip3] + } + }}, + Component{Item{ + id: winScreen + z: 101 + width: root.width + height: root.height + /* + Rectangle{ + anchors.fill: parent + color: "black" + } + */ + Text{//TODO: Particle Text? + anchors.fill: parent + color: "white" + font.pixelSize: 64 + font.bold: true + text: "Player " + root.winner + " wins!" + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + MouseArea{ + anchors.fill: parent + onClicked: {pageControl.at = 0; pageControl.advance();} + } + }}, + Component{ + HelpScreens{ + onExitDesired: {pageControl.at = 0; pageControl.advance();} + } + } + ] + } +} diff --git a/examples/declarative/rssnews/content/BusyIndicator.qml b/examples/declarative/rssnews/content/BusyIndicator.qml new file mode 100644 index 0000000000..3ee30d962b --- /dev/null +++ b/examples/declarative/rssnews/content/BusyIndicator.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/content/CategoryDelegate.qml b/examples/declarative/rssnews/content/CategoryDelegate.qml new file mode 100644 index 0000000000..0ae9fbec13 --- /dev/null +++ b/examples/declarative/rssnews/content/CategoryDelegate.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/content/NewsDelegate.qml b/examples/declarative/rssnews/content/NewsDelegate.qml new file mode 100644 index 0000000000..061abb24fa --- /dev/null +++ b/examples/declarative/rssnews/content/NewsDelegate.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/content/RssFeeds.qml b/examples/declarative/rssnews/content/RssFeeds.qml new file mode 100644 index 0000000000..09b1ad808c --- /dev/null +++ b/examples/declarative/rssnews/content/RssFeeds.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/content/ScrollBar.qml b/examples/declarative/rssnews/content/ScrollBar.qml new file mode 100644 index 0000000000..e54be7b6a8 --- /dev/null +++ b/examples/declarative/rssnews/content/ScrollBar.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/content/images/busy.png b/examples/declarative/rssnews/content/images/busy.png new file mode 100644 index 0000000000..664c2b1491 Binary files /dev/null and b/examples/declarative/rssnews/content/images/busy.png differ diff --git a/examples/declarative/rssnews/content/images/scrollbar.png b/examples/declarative/rssnews/content/images/scrollbar.png new file mode 100644 index 0000000000..0228dcf9eb Binary files /dev/null and b/examples/declarative/rssnews/content/images/scrollbar.png differ diff --git a/examples/declarative/rssnews/rssnews.qml b/examples/declarative/rssnews/rssnews.qml new file mode 100644 index 0000000000..b2057a9ed3 --- /dev/null +++ b/examples/declarative/rssnews/rssnews.qml @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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.qmlproject b/examples/declarative/rssnews/rssnews.qmlproject new file mode 100644 index 0000000000..d4909f8685 --- /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: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/samegame/SamegameCore/BoomBlock.qml b/examples/declarative/samegame/SamegameCore/BoomBlock.qml new file mode 100644 index 0000000000..2d8fdba2c9 --- /dev/null +++ b/examples/declarative/samegame/SamegameCore/BoomBlock.qml @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Particles 2.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 + } + Emitter { + id: particles + system: particleSystem + particle: { + if(type == 0){ + "red"; + } else if (type == 1) { + "blue"; + } else { + "green"; + } + } + anchors.fill: parent + + speed: TargetedDirection{targetX: block.width/2; targetY: block.height/2; magnitude: -60; magnitudeVariation: 60} + shape: EllipseShape{fill:true} + emitting: false; + lifeSpan: 700; lifeSpanVariation: 100 + emitRate: 1000 + emitCap: 100 //only fires 0.1s bursts (still 2x old number, ImageParticle wants less than 16000 max though) + size: 28 + endSize: 14 + } + + states: [ + State { + name: "AliveState"; when: spawned == true && dying == false + PropertyChanges { target: img; opacity: 1 } + }, + + State { + name: "DeathState"; when: dying == true + StateChangeScript { script: particles.pulse(0.1); } + PropertyChanges { target: img; opacity: 0 } + StateChangeScript { script: block.destroy(1000); } + } + ] +} diff --git a/examples/declarative/samegame/SamegameCore/Button.qml b/examples/declarative/samegame/SamegameCore/Button.qml new file mode 100644 index 0000000000..be9ad62dfd --- /dev/null +++ b/examples/declarative/samegame/SamegameCore/Button.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +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/SamegameCore/Dialog.qml b/examples/declarative/samegame/SamegameCore/Dialog.qml new file mode 100644 index 0000000000..aea6ac7dda --- /dev/null +++ b/examples/declarative/samegame/SamegameCore/Dialog.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + id: page + + property Item text: dialogText + property bool open: false + + signal closed + signal opened + function forceClose() { + if(!open) + return; //already closed + page.open = false; + page.closed(); + page.opacity = 0; + } + + function show(txt) { + page.open = true; + 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/SamegameCore/pics/background.png b/examples/declarative/samegame/SamegameCore/pics/background.png new file mode 100644 index 0000000000..3734a27744 Binary files /dev/null and b/examples/declarative/samegame/SamegameCore/pics/background.png differ diff --git a/examples/declarative/samegame/SamegameCore/pics/blueStone.png b/examples/declarative/samegame/SamegameCore/pics/blueStone.png new file mode 100644 index 0000000000..20e43c75b6 Binary files /dev/null and b/examples/declarative/samegame/SamegameCore/pics/blueStone.png differ diff --git a/examples/declarative/samegame/SamegameCore/pics/greenStone.png b/examples/declarative/samegame/SamegameCore/pics/greenStone.png new file mode 100644 index 0000000000..b568a1900c Binary files /dev/null and b/examples/declarative/samegame/SamegameCore/pics/greenStone.png differ diff --git a/examples/declarative/samegame/SamegameCore/pics/particle.png b/examples/declarative/samegame/SamegameCore/pics/particle.png new file mode 100644 index 0000000000..5c83896d22 Binary files /dev/null and b/examples/declarative/samegame/SamegameCore/pics/particle.png differ diff --git a/examples/declarative/samegame/SamegameCore/pics/redStone.png b/examples/declarative/samegame/SamegameCore/pics/redStone.png new file mode 100644 index 0000000000..36b09a2686 Binary files /dev/null and b/examples/declarative/samegame/SamegameCore/pics/redStone.png differ diff --git a/examples/declarative/samegame/SamegameCore/pics/yellowStone.png b/examples/declarative/samegame/SamegameCore/pics/yellowStone.png new file mode 100644 index 0000000000..b1ce76212c Binary files /dev/null and b/examples/declarative/samegame/SamegameCore/pics/yellowStone.png differ diff --git a/examples/declarative/samegame/SamegameCore/qmldir b/examples/declarative/samegame/SamegameCore/qmldir new file mode 100644 index 0000000000..e17b1f5d2b --- /dev/null +++ b/examples/declarative/samegame/SamegameCore/qmldir @@ -0,0 +1,3 @@ +BoomBlock BoomBlock.qml +Button Button.qml +Dialog Dialog.qml diff --git a/examples/declarative/samegame/SamegameCore/samegame.js b/examples/declarative/samegame/SamegameCore/samegame.js new file mode 100755 index 0000000000..4c5cbe5bb3 --- /dev/null +++ b/examples/declarative/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 = "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/highscores/README b/examples/declarative/samegame/highscores/README new file mode 100644 index 0000000000..eaa00fae37 --- /dev/null +++ b/examples/declarative/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/highscores/score_data.xml b/examples/declarative/samegame/highscores/score_data.xml new file mode 100755 index 0000000000..c3fd90d9cf --- /dev/null +++ b/examples/declarative/samegame/highscores/score_data.xml @@ -0,0 +1,2 @@ +1000000Alan the Tester0x00 +6213Alan12x1751 diff --git a/examples/declarative/samegame/highscores/score_style.xsl b/examples/declarative/samegame/highscores/score_style.xsl new file mode 100755 index 0000000000..670354c965 --- /dev/null +++ b/examples/declarative/samegame/highscores/score_style.xsl @@ -0,0 +1,28 @@ + + + + + SameGame High Scores + +

SameGame High Scores

+ + + + + + + + + + + + + + + + +
NameScoreGrid SizeTime, s
+ + +
+
diff --git a/examples/declarative/samegame/highscores/scores.php b/examples/declarative/samegame/highscores/scores.php new file mode 100755 index 0000000000..3cceb2d738 --- /dev/null +++ b/examples/declarative/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/samegame.qml b/examples/declarative/samegame/samegame.qml new file mode 100644 index 0000000000..0daf72de58 --- /dev/null +++ b/examples/declarative/samegame/samegame.qml @@ -0,0 +1,192 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Particles 2.0 +import "SamegameCore" +import "SamegameCore/samegame.js" as Logic + +Rectangle { + id: screen + width: 360; height: 640 + 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); + } + } + Item{ + ParticleSystem{ id: particleSystem; } + ImageParticle { + system: particleSystem + particles: ["red"] + color: Qt.darker("red");//Actually want desaturated... + source: "SamegameCore/pics/particle.png" + colorVariation: 0.4 + alpha: 0.1 + } + ImageParticle { + system: particleSystem + particles: ["green"] + color: Qt.darker("green");//Actually want desaturated... + source: "SamegameCore/pics/particle.png" + colorVariation: 0.4 + alpha: 0.1 + } + ImageParticle { + system: particleSystem + particles: ["blue"] + color: Qt.darker("blue");//Actually want desaturated... + source: "SamegameCore/pics/particle.png" + colorVariation: 0.4 + alpha: 0.1 + } + id: aboveGameCanvas + anchors.fill: gameCanvas + z: gameCanvas.z + 1 + } + } + + 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.qmlproject b/examples/declarative/samegame/samegame.qmlproject new file mode 100644 index 0000000000..d4909f8685 --- /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: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/shadereffects/Slider.qml b/examples/declarative/shadereffects/Slider.qml new file mode 100644 index 0000000000..e31335d984 --- /dev/null +++ b/examples/declarative/shadereffects/Slider.qml @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Declarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + property real value: bar.x / (foo.width - bar.width) + Item { + id: foo + width: parent.width - 4 + height: 6 + anchors.centerIn: parent + + Rectangle { + height: parent.height + anchors.left: parent.left + anchors.right: bar.horizontalCenter + color: "blue" + radius: 3 + } + Rectangle { + height: parent.height + anchors.left: bar.horizontalCenter + anchors.right: parent.right + color: "gray" + radius: 3 + } + Rectangle { + anchors.fill: parent + color: "transparent" + radius: 3 + border.width: 2 + border.color: "black" + } + + Rectangle { + id: bar + y: -7 + width: 20 + height: 20 + radius: 15 + color: "white" + border.width: 2 + border.color: "black" + MouseArea { + anchors.fill: parent + drag.target: parent + drag.axis: Drag.XAxis + drag.minimumX: 0 + drag.maximumX: foo.width - parent.width + } + } + } +} + diff --git a/examples/declarative/shadereffects/face-smile.png b/examples/declarative/shadereffects/face-smile.png new file mode 100644 index 0000000000..3d66d72578 Binary files /dev/null and b/examples/declarative/shadereffects/face-smile.png differ diff --git a/examples/declarative/shadereffects/qt-logo.png b/examples/declarative/shadereffects/qt-logo.png new file mode 100644 index 0000000000..7d3e97eb36 Binary files /dev/null and b/examples/declarative/shadereffects/qt-logo.png differ diff --git a/examples/declarative/shadereffects/shader-demo.qml b/examples/declarative/shadereffects/shader-demo.qml new file mode 100644 index 0000000000..1226064a5d --- /dev/null +++ b/examples/declarative/shadereffects/shader-demo.qml @@ -0,0 +1,295 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Declarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Image { + width: 640 + height: 360 + source: "../snake/content/pics/background.png" + + ShaderEffectSource { + id: theSource + sourceItem: theItem + smooth: true + } + + function saturate(x) { + return Math.min(Math.max(x, 0), 1) + } + + function sliderToColor(x) { + return Qt.rgba(saturate(Math.max(2 - 6 * x, 6 * x - 4)), + saturate(Math.min(6 * x, 4 - 6 * x)), + saturate(Math.min(6 * x - 2, 6 - 6 * x))) + } + + Grid { + anchors.centerIn: parent + columns: 3 + + Item { + id: theItem + width: 180 + height: 180 + ListView { + anchors.centerIn: parent + width: 160 + height: 140 + clip: true + snapMode: ListView.SnapOneItem + model: VisualItemModel { + Text { + width: 160 + height: 140 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font.pixelSize: 120 + font.family: "Times" + color: "blue" + text: "Qt" + } + Image { + width: 160 + height: 140 + source: "qt-logo.png" + smooth: true + } + Image { + width: 160 + height: 140 + source: "face-smile.png" + smooth: true + } + } + } + } + ShaderEffectItem { + width: 180 + height: 180 + property variant source: theSource + property real amplitude: 0.04 * wobbleSlider.value + property real frequency: 20 + property real time: 0 + NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 } + fragmentShader: + "uniform highp float amplitude;" + + "uniform highp float frequency;" + + "uniform highp float time;" + + "uniform sampler2D source;" + + "varying highp vec2 qt_TexCoord0;" + + "void main() {" + + " highp vec2 p = sin(time + frequency * qt_TexCoord0);" + + " gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x));" + + "}" + Slider { + id: wobbleSlider + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: 40 + } + } + ShaderEffectItem { + width: 180 + height: 180 + property variant source: theSource + property variant shadow: ShaderEffectSource { + smooth: true + sourceItem: ShaderEffectItem { + width: theItem.width + height: theItem.height + property variant delta: Qt.size(0.0, 1.0 / height) + property variant source: ShaderEffectSource { + smooth: true + sourceItem: ShaderEffectItem { + width: theItem.width + height: theItem.height + property variant delta: Qt.size(1.0 / width, 0.0) + property variant source: theSource + fragmentShader: " + uniform sampler2D source; + uniform highp vec2 delta; + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = 0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta) + + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta) + + 0.2466 * texture2D(source, qt_TexCoord0) + + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta) + + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta); + }" + } + } + fragmentShader: " + uniform sampler2D source; + uniform highp vec2 delta; + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = 0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta) + + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta) + + 0.2466 * texture2D(source, qt_TexCoord0) + + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta) + + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta); + }" + } + } + property real angle: 0 + property variant offset: Qt.point(15.0 * Math.cos(angle), 15.0 * Math.sin(angle)) + NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 } + property variant delta: Qt.size(offset.x / width, offset.y / height) + property real darkness: shadowSlider.value + fragmentShader: " + uniform highp vec2 offset; + uniform sampler2D source; + uniform sampler2D shadow; + uniform highp float darkness; + uniform highp vec2 delta; + varying highp vec2 qt_TexCoord0; + void main() { + lowp vec4 fg = texture2D(source, qt_TexCoord0); + lowp vec4 bg = texture2D(shadow, qt_TexCoord0 + delta); + gl_FragColor = fg + vec4(0., 0., 0., darkness * bg.a) * (1. - fg.a); + }" + Slider { + id: shadowSlider + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: 40 + } + } + ShaderEffectItem { + width: 180 + height: 180 + property variant source: theSource + property variant delta: Qt.size(0.5 / width, 0.5 / height) + fragmentShader: " + uniform sampler2D source; + uniform highp vec2 delta; + uniform highp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + void main() { + lowp vec4 tl = texture2D(source, qt_TexCoord0 - delta); + lowp vec4 tr = texture2D(source, qt_TexCoord0 + vec2(delta.x, -delta.y)); + lowp vec4 bl = texture2D(source, qt_TexCoord0 - vec2(delta.x, -delta.y)); + lowp vec4 br = texture2D(source, qt_TexCoord0 + delta); + lowp vec4 gx = (tl + bl) - (tr + br); + lowp vec4 gy = (tl + tr) - (bl + br); + gl_FragColor.xyz = vec3(0.); + gl_FragColor.w = clamp(dot(sqrt(gx * gx + gy * gy), vec4(1.)), 0., 1.) * qt_Opacity; + }" + } + ShaderEffectItem { + width: 180 + height: 180 + property variant source: theSource + property color tint: sliderToColor(colorizeSlider.value) + fragmentShader: " + uniform sampler2D source; + uniform lowp vec4 tint; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + void main() { + lowp vec4 c = texture2D(source, qt_TexCoord0); + lowp float lo = min(min(c.x, c.y), c.z); + lowp float hi = max(max(c.x, c.y), c.z); + gl_FragColor = qt_Opacity * vec4(mix(vec3(lo), vec3(hi), tint.xyz), c.w); + }" + Slider { + id: colorizeSlider + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: 40 + } + } + ShaderEffectItem { + width: 180 + height: 180 + mesh: GridMesh { resolution: Qt.size(10, 10) } + property variant source: theSource + property real bend: 0 + property real minimize: 0 + property real side: genieSlider.value + SequentialAnimation on bend { + loops: Animation.Infinite + NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine } + PauseAnimation { duration: 1600 } + NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine } + PauseAnimation { duration: 1000 } + } + SequentialAnimation on minimize { + loops: Animation.Infinite + PauseAnimation { duration: 300 } + NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine } + PauseAnimation { duration: 1000 } + NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine } + PauseAnimation { duration: 1300 } + } + vertexShader: " + uniform highp mat4 qt_ModelViewProjectionMatrix; + uniform highp float bend; + uniform highp float minimize; + uniform highp float side; + uniform highp float width; + uniform highp float height; + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + varying highp vec2 qt_TexCoord0; + void main() { + qt_TexCoord0 = qt_MultiTexCoord0; + highp vec4 pos = qt_Vertex; + pos.y = mix(qt_Vertex.y, height, minimize); + highp float t = pos.y / height; + t = (3. - 2. * t) * t * t; + pos.x = mix(qt_Vertex.x, side * width, t * bend); + gl_Position = qt_ModelViewProjectionMatrix * pos; + }" + Slider { + id: genieSlider + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: 40 + } + } + } +} diff --git a/examples/declarative/snake/content/Button.qml b/examples/declarative/snake/content/Button.qml new file mode 100644 index 0000000000..d8a3363d6d --- /dev/null +++ b/examples/declarative/snake/content/Button.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/content/Cookie.qml b/examples/declarative/snake/content/Cookie.qml new file mode 100644 index 0000000000..29b56f9e88 --- /dev/null +++ b/examples/declarative/snake/content/Cookie.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/content/HighScoreModel.qml b/examples/declarative/snake/content/HighScoreModel.qml new file mode 100644 index 0000000000..91b2185ffc --- /dev/null +++ b/examples/declarative/snake/content/HighScoreModel.qml @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/content/Link.qml b/examples/declarative/snake/content/Link.qml new file mode 100644 index 0000000000..ff67ad749e --- /dev/null +++ b/examples/declarative/snake/content/Link.qml @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/content/Skull.qml b/examples/declarative/snake/content/Skull.qml new file mode 100644 index 0000000000..4f48145f84 --- /dev/null +++ b/examples/declarative/snake/content/Skull.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/content/pics/README b/examples/declarative/snake/content/pics/README new file mode 100644 index 0000000000..0215132caa --- /dev/null +++ b/examples/declarative/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/content/pics/background.png b/examples/declarative/snake/content/pics/background.png new file mode 100644 index 0000000000..72dffaa843 Binary files /dev/null and b/examples/declarative/snake/content/pics/background.png differ diff --git a/examples/declarative/snake/content/pics/blueStar.png b/examples/declarative/snake/content/pics/blueStar.png new file mode 100644 index 0000000000..ba7acabd26 Binary files /dev/null and b/examples/declarative/snake/content/pics/blueStar.png differ diff --git a/examples/declarative/snake/content/pics/blueStone.png b/examples/declarative/snake/content/pics/blueStone.png new file mode 100644 index 0000000000..356affdd95 Binary files /dev/null and b/examples/declarative/snake/content/pics/blueStone.png differ diff --git a/examples/declarative/snake/content/pics/cookie.png b/examples/declarative/snake/content/pics/cookie.png new file mode 100644 index 0000000000..aec2957f34 Binary files /dev/null and b/examples/declarative/snake/content/pics/cookie.png differ diff --git a/examples/declarative/snake/content/pics/eyes.svg b/examples/declarative/snake/content/pics/eyes.svg new file mode 100644 index 0000000000..1078692725 --- /dev/null +++ b/examples/declarative/snake/content/pics/eyes.svg @@ -0,0 +1,118 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/examples/declarative/snake/content/pics/head.png b/examples/declarative/snake/content/pics/head.png new file mode 100644 index 0000000000..550e002687 Binary files /dev/null and b/examples/declarative/snake/content/pics/head.png differ diff --git a/examples/declarative/snake/content/pics/head.svg b/examples/declarative/snake/content/pics/head.svg new file mode 100644 index 0000000000..3bf0bd2feb --- /dev/null +++ b/examples/declarative/snake/content/pics/head.svg @@ -0,0 +1,134 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/examples/declarative/snake/content/pics/pause.png b/examples/declarative/snake/content/pics/pause.png new file mode 100644 index 0000000000..056d97dd17 Binary files /dev/null and b/examples/declarative/snake/content/pics/pause.png differ diff --git a/examples/declarative/snake/content/pics/redStar.png b/examples/declarative/snake/content/pics/redStar.png new file mode 100644 index 0000000000..cd06854719 Binary files /dev/null and b/examples/declarative/snake/content/pics/redStar.png differ diff --git a/examples/declarative/snake/content/pics/redStone.png b/examples/declarative/snake/content/pics/redStone.png new file mode 100644 index 0000000000..9bb7fe4277 Binary files /dev/null and b/examples/declarative/snake/content/pics/redStone.png differ diff --git a/examples/declarative/snake/content/pics/skull.png b/examples/declarative/snake/content/pics/skull.png new file mode 100644 index 0000000000..63186167bd Binary files /dev/null and b/examples/declarative/snake/content/pics/skull.png differ diff --git a/examples/declarative/snake/content/pics/snake.jpg b/examples/declarative/snake/content/pics/snake.jpg new file mode 100644 index 0000000000..e91a784f71 Binary files /dev/null and b/examples/declarative/snake/content/pics/snake.jpg differ diff --git a/examples/declarative/snake/content/pics/star.png b/examples/declarative/snake/content/pics/star.png new file mode 100644 index 0000000000..defbde53ca Binary files /dev/null and b/examples/declarative/snake/content/pics/star.png differ diff --git a/examples/declarative/snake/content/pics/stoneShadow.png b/examples/declarative/snake/content/pics/stoneShadow.png new file mode 100644 index 0000000000..1bd56afd04 Binary files /dev/null and b/examples/declarative/snake/content/pics/stoneShadow.png differ diff --git a/examples/declarative/snake/content/pics/yellowStar.png b/examples/declarative/snake/content/pics/yellowStar.png new file mode 100644 index 0000000000..52fb9c4b78 Binary files /dev/null and b/examples/declarative/snake/content/pics/yellowStar.png differ diff --git a/examples/declarative/snake/content/pics/yellowStone.png b/examples/declarative/snake/content/pics/yellowStone.png new file mode 100644 index 0000000000..c56124a895 Binary files /dev/null and b/examples/declarative/snake/content/pics/yellowStone.png differ diff --git a/examples/declarative/snake/content/snake.js b/examples/declarative/snake/content/snake.js new file mode 100644 index 0000000000..837b82addd --- /dev/null +++ b/examples/declarative/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/snake.qml b/examples/declarative/snake/snake.qml new file mode 100644 index 0000000000..edccd4c9df --- /dev/null +++ b/examples/declarative/snake/snake.qml @@ -0,0 +1,272 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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 && runtime.isActiveWindow + 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.qmlproject b/examples/declarative/snake/snake.qmlproject new file mode 100644 index 0000000000..d4909f8685 --- /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: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/twitter/TwitterCore/Button.qml b/examples/declarative/twitter/TwitterCore/Button.qml new file mode 100644 index 0000000000..34ca181527 --- /dev/null +++ b/examples/declarative/twitter/TwitterCore/Button.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/TwitterCore/FatDelegate.qml b/examples/declarative/twitter/TwitterCore/FatDelegate.qml new file mode 100644 index 0000000000..1fe289159c --- /dev/null +++ b/examples/declarative/twitter/TwitterCore/FatDelegate.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/TwitterCore/Input.qml b/examples/declarative/twitter/TwitterCore/Input.qml new file mode 100644 index 0000000000..96fafb6bd2 --- /dev/null +++ b/examples/declarative/twitter/TwitterCore/Input.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/TwitterCore/Loading.qml b/examples/declarative/twitter/TwitterCore/Loading.qml new file mode 100644 index 0000000000..e0c4fa03eb --- /dev/null +++ b/examples/declarative/twitter/TwitterCore/Loading.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/TwitterCore/MultiTitleBar.qml b/examples/declarative/twitter/TwitterCore/MultiTitleBar.qml new file mode 100644 index 0000000000..6933d485c0 --- /dev/null +++ b/examples/declarative/twitter/TwitterCore/MultiTitleBar.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/TwitterCore/RssModel.qml b/examples/declarative/twitter/TwitterCore/RssModel.qml new file mode 100644 index 0000000000..696ae9d24d --- /dev/null +++ b/examples/declarative/twitter/TwitterCore/RssModel.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/TwitterCore/SearchView.qml b/examples/declarative/twitter/TwitterCore/SearchView.qml new file mode 100644 index 0000000000..6e099ae1c7 --- /dev/null +++ b/examples/declarative/twitter/TwitterCore/SearchView.qml @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/TwitterCore/TitleBar.qml b/examples/declarative/twitter/TwitterCore/TitleBar.qml new file mode 100644 index 0000000000..1a2f5d5855 --- /dev/null +++ b/examples/declarative/twitter/TwitterCore/TitleBar.qml @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/TwitterCore/ToolBar.qml b/examples/declarative/twitter/TwitterCore/ToolBar.qml new file mode 100644 index 0000000000..b277517332 --- /dev/null +++ b/examples/declarative/twitter/TwitterCore/ToolBar.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/TwitterCore/UserModel.qml b/examples/declarative/twitter/TwitterCore/UserModel.qml new file mode 100644 index 0000000000..b87a083eae --- /dev/null +++ b/examples/declarative/twitter/TwitterCore/UserModel.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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/TwitterCore/images/gloss.png b/examples/declarative/twitter/TwitterCore/images/gloss.png new file mode 100644 index 0000000000..5d370cd93d Binary files /dev/null and b/examples/declarative/twitter/TwitterCore/images/gloss.png differ diff --git a/examples/declarative/twitter/TwitterCore/images/lineedit.png b/examples/declarative/twitter/TwitterCore/images/lineedit.png new file mode 100644 index 0000000000..2cc38dc35b Binary files /dev/null and b/examples/declarative/twitter/TwitterCore/images/lineedit.png differ diff --git a/examples/declarative/twitter/TwitterCore/images/lineedit.sci b/examples/declarative/twitter/TwitterCore/images/lineedit.sci new file mode 100644 index 0000000000..054bff78be --- /dev/null +++ b/examples/declarative/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/TwitterCore/images/loading.png b/examples/declarative/twitter/TwitterCore/images/loading.png new file mode 100644 index 0000000000..47a1589c5d Binary files /dev/null and b/examples/declarative/twitter/TwitterCore/images/loading.png differ diff --git a/examples/declarative/twitter/TwitterCore/images/quit.png b/examples/declarative/twitter/TwitterCore/images/quit.png new file mode 100644 index 0000000000..5bda1b6e0d Binary files /dev/null and b/examples/declarative/twitter/TwitterCore/images/quit.png differ diff --git a/examples/declarative/twitter/TwitterCore/images/stripes.png b/examples/declarative/twitter/TwitterCore/images/stripes.png new file mode 100644 index 0000000000..9f36727ea4 Binary files /dev/null and b/examples/declarative/twitter/TwitterCore/images/stripes.png differ diff --git a/examples/declarative/twitter/TwitterCore/images/titlebar.png b/examples/declarative/twitter/TwitterCore/images/titlebar.png new file mode 100644 index 0000000000..51c90082d0 Binary files /dev/null and b/examples/declarative/twitter/TwitterCore/images/titlebar.png differ diff --git a/examples/declarative/twitter/TwitterCore/images/titlebar.sci b/examples/declarative/twitter/TwitterCore/images/titlebar.sci new file mode 100644 index 0000000000..0418d94cd6 --- /dev/null +++ b/examples/declarative/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/TwitterCore/images/toolbutton.png b/examples/declarative/twitter/TwitterCore/images/toolbutton.png new file mode 100644 index 0000000000..11310013ee Binary files /dev/null and b/examples/declarative/twitter/TwitterCore/images/toolbutton.png differ diff --git a/examples/declarative/twitter/TwitterCore/images/toolbutton.sci b/examples/declarative/twitter/TwitterCore/images/toolbutton.sci new file mode 100644 index 0000000000..9e4f965307 --- /dev/null +++ b/examples/declarative/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/TwitterCore/qmldir b/examples/declarative/twitter/TwitterCore/qmldir new file mode 100644 index 0000000000..84d85c2885 --- /dev/null +++ b/examples/declarative/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/twitter.qml b/examples/declarative/twitter/twitter.qml new file mode 100644 index 0000000000..1700b5dcd1 --- /dev/null +++ b/examples/declarative/twitter/twitter.qml @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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.qmlproject b/examples/declarative/twitter/twitter.qmlproject new file mode 100644 index 0000000000..d4909f8685 --- /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: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/embedded/embedded.pro b/examples/embedded/embedded.pro new file mode 100644 index 0000000000..81334fa552 --- /dev/null +++ b/examples/embedded/embedded.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS += qmleasing qmlflickr qmldialcontrol qmlcalculator qmlphotoviewer qmlclocks qmltwitter diff --git a/examples/embedded/qmlcalculator/deployment.pri b/examples/embedded/qmlcalculator/deployment.pri new file mode 100644 index 0000000000..a97498e91f --- /dev/null +++ b/examples/embedded/qmlcalculator/deployment.pri @@ -0,0 +1,8 @@ +qmlcalculator_src = $$PWD/../../declarative/calculator +symbian { + load(data_caging_paths) + qmlcalculator_uid3 = A000E3FB + qmlcalculator_files.path = $$APP_PRIVATE_DIR_BASE/$$qmlcalculator_uid3 +} +qmlcalculator_files.files = $$qmlcalculator_src/calculator.qml $$qmlcalculator_src/Core +DEPLOYMENT += qmlcalculator_files diff --git a/examples/embedded/qmlcalculator/qmlcalculator.cpp b/examples/embedded/qmlcalculator/qmlcalculator.cpp new file mode 100644 index 0000000000..bed579726c --- /dev/null +++ b/examples/embedded/qmlcalculator/qmlcalculator.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +#if defined(Q_OS_SYMBIAN) +#include +#include +#include +#include +#endif // Q_OS_SYMBIAN + +int main(int argc, char *argv[]) +{ + QApplication application(argc, argv); + + const QString mainQmlApp = QLatin1String("calculator.qml"); + QDeclarativeView view; + view.setSource(QUrl(mainQmlApp)); + view.setResizeMode(QDeclarativeView::SizeRootObjectToView); + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); + +#if defined(QT_KEYPAD_NAVIGATION) + QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); +#endif // QT_KEYPAD_NAVIGATION + +#if defined(Q_OS_SYMBIAN) + CAknAppUi* appUi = dynamic_cast (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait) + ) + view.showFullScreen(); +#else // Q_OS_SYMBIAN + view.show(); +#endif // Q_OS_SYMBIAN + + return application.exec(); +} diff --git a/examples/embedded/qmlcalculator/qmlcalculator.pro b/examples/embedded/qmlcalculator/qmlcalculator.pro new file mode 100644 index 0000000000..4a82d32227 --- /dev/null +++ b/examples/embedded/qmlcalculator/qmlcalculator.pro @@ -0,0 +1,12 @@ +!symbian:!wince*:warning("DEPLOYMENT support required. This project only works on Symbian and WinCE.") + +QT += declarative +SOURCES += $$PWD/qmlcalculator.cpp +include($$PWD/deployment.pri) + +symbian { + TARGET.UID3 = 0x$$qmlcalculator_uid3 # defined in deployment.pri + CONFIG += qt_demo + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + LIBS += -lcone -leikcore -lavkon # Screen orientation +} diff --git a/examples/embedded/qmlclocks/deployment.pri b/examples/embedded/qmlclocks/deployment.pri new file mode 100644 index 0000000000..6c6704ccc7 --- /dev/null +++ b/examples/embedded/qmlclocks/deployment.pri @@ -0,0 +1,8 @@ +qmlclocks_src = $$PWD/../../../examples/declarative/toys/clocks +symbian { + load(data_caging_paths) + qmlclocks_uid3 = A000E3FC + qmlclocks_files.path = $$APP_PRIVATE_DIR_BASE/$$qmlclocks_uid3 +} +qmlclocks_files.files = $$qmlclocks_src/clocks.qml $$qmlclocks_src/content +DEPLOYMENT += qmlclocks_files diff --git a/examples/embedded/qmlclocks/qmlclocks.cpp b/examples/embedded/qmlclocks/qmlclocks.cpp new file mode 100644 index 0000000000..75d0be0874 --- /dev/null +++ b/examples/embedded/qmlclocks/qmlclocks.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +#if defined(Q_OS_SYMBIAN) +#include +#include +#include +#include +#endif // Q_OS_SYMBIAN + +int main(int argc, char *argv[]) +{ + QApplication application(argc, argv); + + const QString mainQmlApp = QLatin1String("clocks.qml"); + QDeclarativeView view; + view.setSource(QUrl(mainQmlApp)); + view.setResizeMode(QDeclarativeView::SizeRootObjectToView); + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); + +#if defined(QT_KEYPAD_NAVIGATION) + QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); +#endif // QT_KEYPAD_NAVIGATION + +#if defined(Q_OS_SYMBIAN) + CAknAppUi* appUi = dynamic_cast (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape) + ) + view.showFullScreen(); +#else // Q_OS_SYMBIAN + view.show(); +#endif // Q_OS_SYMBIAN + + return application.exec(); +} diff --git a/examples/embedded/qmlclocks/qmlclocks.pro b/examples/embedded/qmlclocks/qmlclocks.pro new file mode 100644 index 0000000000..cc97a7394b --- /dev/null +++ b/examples/embedded/qmlclocks/qmlclocks.pro @@ -0,0 +1,12 @@ +!symbian:!wince*:warning("DEPLOYMENT support required. This project only works on Symbian and WinCE.") + +QT += declarative +SOURCES += $$PWD/qmlclocks.cpp +include($$PWD/deployment.pri) + +symbian { + TARGET.UID3 = 0x$$qmlclocks_uid3 # defined in deployment.pri + CONFIG += qt_demo + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + LIBS += -lcone -leikcore -lavkon # Screen orientation +} diff --git a/examples/embedded/qmldialcontrol/deployment.pri b/examples/embedded/qmldialcontrol/deployment.pri new file mode 100644 index 0000000000..a9784439a4 --- /dev/null +++ b/examples/embedded/qmldialcontrol/deployment.pri @@ -0,0 +1,8 @@ +qmldialcontrol_src = $$PWD/../../../examples/declarative/ui-components/dialcontrol +symbian { + load(data_caging_paths) + qmldialcontrol_uid3 = A000E3FD + qmldialcontrol_files.path = $$APP_PRIVATE_DIR_BASE/$$qmldialcontrol_uid3 +} +qmldialcontrol_files.files = $$qmldialcontrol_src/dialcontrol.qml $$qmldialcontrol_src/content +DEPLOYMENT += qmldialcontrol_files diff --git a/examples/embedded/qmldialcontrol/qmldialcontrol.cpp b/examples/embedded/qmldialcontrol/qmldialcontrol.cpp new file mode 100644 index 0000000000..7cc4ed6668 --- /dev/null +++ b/examples/embedded/qmldialcontrol/qmldialcontrol.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication application(argc, argv); + + const QString mainQmlApp = QLatin1String("dialcontrol.qml"); + QDeclarativeView view; + view.setSource(QUrl(mainQmlApp)); + view.setResizeMode(QDeclarativeView::SizeRootObjectToView); + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); + +#if defined(QT_KEYPAD_NAVIGATION) + QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); +#endif // QT_KEYPAD_NAVIGATION + +#if defined(Q_OS_SYMBIAN) + view.showFullScreen(); +#else // Q_OS_SYMBIAN + view.show(); +#endif // Q_OS_SYMBIAN + + return application.exec(); +} diff --git a/examples/embedded/qmldialcontrol/qmldialcontrol.pro b/examples/embedded/qmldialcontrol/qmldialcontrol.pro new file mode 100644 index 0000000000..348c41a85d --- /dev/null +++ b/examples/embedded/qmldialcontrol/qmldialcontrol.pro @@ -0,0 +1,11 @@ +!symbian:!wince*:warning("DEPLOYMENT support required. This project only works on Symbian and WinCE.") + +QT += declarative +SOURCES += $$PWD/qmldialcontrol.cpp +include($$PWD/deployment.pri) + +symbian { + TARGET.UID3 = 0x$$qmldialcontrol_uid3 # defined in deployment.pri + CONFIG += qt_demo + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 +} diff --git a/examples/embedded/qmleasing/deployment.pri b/examples/embedded/qmleasing/deployment.pri new file mode 100644 index 0000000000..946fcd9d89 --- /dev/null +++ b/examples/embedded/qmleasing/deployment.pri @@ -0,0 +1,8 @@ +qmleasing_src = $$PWD/../../../examples/declarative/animation/easing +symbian { + load(data_caging_paths) + qmleasing_uid3 = A000E3FE + qmleasing_files.path = $$APP_PRIVATE_DIR_BASE/$$qmleasing_uid3 +} +qmleasing_files.files = $$qmleasing_src/easing.qml $$qmleasing_src/content +DEPLOYMENT += qmleasing_files diff --git a/examples/embedded/qmleasing/qmleasing.cpp b/examples/embedded/qmleasing/qmleasing.cpp new file mode 100644 index 0000000000..38c457d376 --- /dev/null +++ b/examples/embedded/qmleasing/qmleasing.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication application(argc, argv); + + const QString mainQmlApp = QLatin1String("easing.qml"); + QDeclarativeView view; + view.setSource(QUrl(mainQmlApp)); + view.setResizeMode(QDeclarativeView::SizeRootObjectToView); + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); + +#if defined(QT_KEYPAD_NAVIGATION) + QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); +#endif // QT_KEYPAD_NAVIGATION + +#if defined(Q_OS_SYMBIAN) + view.showFullScreen(); +#else // Q_OS_SYMBIAN + view.show(); +#endif // Q_OS_SYMBIAN + + return application.exec(); +} diff --git a/examples/embedded/qmleasing/qmleasing.pro b/examples/embedded/qmleasing/qmleasing.pro new file mode 100644 index 0000000000..9d7c8d7d00 --- /dev/null +++ b/examples/embedded/qmleasing/qmleasing.pro @@ -0,0 +1,11 @@ +!symbian:!wince*:warning("DEPLOYMENT support required. This project only works on Symbian and WinCE.") + +QT += declarative +SOURCES += $$PWD/qmleasing.cpp +include($$PWD/deployment.pri) + +symbian { + TARGET.UID3 = 0x$$qmleasing_uid3 # defined in deployment.pri + CONFIG += qt_demo + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 +} diff --git a/examples/embedded/qmlflickr/deployment.pri b/examples/embedded/qmlflickr/deployment.pri new file mode 100644 index 0000000000..a38dc95f8c --- /dev/null +++ b/examples/embedded/qmlflickr/deployment.pri @@ -0,0 +1,8 @@ +qmlflickr_src = $$PWD/../../declarative/flickr +symbian { + load(data_caging_paths) + qmlflickr_uid3 = A000E3FF + qmlflickr_files.path = $$APP_PRIVATE_DIR_BASE/$$qmlflickr_uid3 +} +qmlflickr_files.files = $$qmlflickr_src/flickr.qml $$qmlflickr_src/common $$qmlflickr_src/mobile +DEPLOYMENT += qmlflickr_files diff --git a/examples/embedded/qmlflickr/qmlflickr.cpp b/examples/embedded/qmlflickr/qmlflickr.cpp new file mode 100644 index 0000000000..052d11c48a --- /dev/null +++ b/examples/embedded/qmlflickr/qmlflickr.cpp @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Factory to create QNetworkAccessManagers that use the saved network configuration; otherwise +// the system default. +class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory +{ +public: + ~NetworkAccessManagerFactory() { } + + QNetworkAccessManager *create(QObject *parent); +}; + +QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) +{ + QNetworkAccessManager *accessManager = new QNetworkAccessManager(parent); + + QNetworkConfigurationManager manager; + if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) { + // Get saved network configuration + QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); + settings.beginGroup(QLatin1String("QtNetwork")); + const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString(); + settings.endGroup(); + + // If the saved network configuration is not currently discovered use the system default + QNetworkConfiguration config = manager.configurationFromIdentifier(id); + if ((config.state() & QNetworkConfiguration::Discovered) != + QNetworkConfiguration::Discovered) { + config = manager.defaultConfiguration(); + } + + accessManager->setConfiguration(config); + } + + return accessManager; +} + +int main(int argc, char *argv[]) +{ + QApplication application(argc, argv); + + NetworkAccessManagerFactory networkAccessManagerFactory; + + const QString mainQmlApp = QLatin1String("flickr.qml"); + QDeclarativeView view; + view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory); + view.setSource(QUrl(mainQmlApp)); + view.setResizeMode(QDeclarativeView::SizeRootObjectToView); + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); + +#if defined(Q_OS_SYMBIAN) + view.showFullScreen(); +#else // Q_OS_SYMBIAN + view.setGeometry(QRect(100, 100, 360, 640)); + view.show(); +#endif // Q_OS_SYMBIAN + return application.exec(); +} + diff --git a/examples/embedded/qmlflickr/qmlflickr.pro b/examples/embedded/qmlflickr/qmlflickr.pro new file mode 100644 index 0000000000..a70a6df894 --- /dev/null +++ b/examples/embedded/qmlflickr/qmlflickr.pro @@ -0,0 +1,13 @@ +!symbian:!wince*:warning("DEPLOYMENT support required. This project only works on Symbian and WinCE.") + +QT += declarative network +SOURCES += $$PWD/qmlflickr.cpp +include($$PWD/deployment.pri) + +symbian { + TARGET.UID3 = 0x$$qmlflickr_uid3 # defined in deployment.pri + CONFIG += qt_demo + TARGET.CAPABILITY = NetworkServices + # Maximum heap size set to 128 MB in order to allow loading large images. + TARGET.EPOCHEAPSIZE = 0x20000 0x8000000 +} diff --git a/examples/embedded/qmlphotoviewer/deployment.pri b/examples/embedded/qmlphotoviewer/deployment.pri new file mode 100644 index 0000000000..23882e3686 --- /dev/null +++ b/examples/embedded/qmlphotoviewer/deployment.pri @@ -0,0 +1,8 @@ +qmlphotoviewer_src = $$PWD/../../declarative/photoviewer +symbian { + load(data_caging_paths) + qmlphotoviewer_uid3 = A000E400 + qmlphotoviewer_files.path = $$APP_PRIVATE_DIR_BASE/$$qmlphotoviewer_uid3 +} +qmlphotoviewer_files.files = $$qmlphotoviewer_src/photoviewer.qml $$qmlphotoviewer_src/PhotoViewerCore +DEPLOYMENT += qmlphotoviewer_files diff --git a/examples/embedded/qmlphotoviewer/qmlphotoviewer.cpp b/examples/embedded/qmlphotoviewer/qmlphotoviewer.cpp new file mode 100644 index 0000000000..89a0902373 --- /dev/null +++ b/examples/embedded/qmlphotoviewer/qmlphotoviewer.cpp @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Factory to create QNetworkAccessManagers that use the saved network configuration; otherwise +// the system default. +class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory +{ +public: + ~NetworkAccessManagerFactory() { } + + QNetworkAccessManager *create(QObject *parent); +}; + +QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) +{ + QNetworkAccessManager *accessManager = new QNetworkAccessManager(parent); + + QNetworkConfigurationManager manager; + if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) { + // Get saved network configuration + QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); + settings.beginGroup(QLatin1String("QtNetwork")); + const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString(); + settings.endGroup(); + + // If the saved network configuration is not currently discovered use the system default + QNetworkConfiguration config = manager.configurationFromIdentifier(id); + if ((config.state() & QNetworkConfiguration::Discovered) != + QNetworkConfiguration::Discovered) { + config = manager.defaultConfiguration(); + } + + accessManager->setConfiguration(config); + } + + return accessManager; +} + +int main(int argc, char *argv[]) +{ + QApplication application(argc, argv); + + NetworkAccessManagerFactory networkAccessManagerFactory; + + const QString mainQmlApp = QLatin1String("photoviewer.qml"); + QDeclarativeView view; + view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory); + view.setSource(QUrl(mainQmlApp)); + view.setResizeMode(QDeclarativeView::SizeRootObjectToView); + + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); + +#if defined(Q_OS_SYMBIAN) + view.showFullScreen(); +#else // Q_OS_SYMBIAN + view.setGeometry(QRect(100, 100, 360, 640)); + view.show(); +#endif // Q_OS_SYMBIAN + return application.exec(); +} + diff --git a/examples/embedded/qmlphotoviewer/qmlphotoviewer.pro b/examples/embedded/qmlphotoviewer/qmlphotoviewer.pro new file mode 100644 index 0000000000..ce6ff552cb --- /dev/null +++ b/examples/embedded/qmlphotoviewer/qmlphotoviewer.pro @@ -0,0 +1,12 @@ +!symbian:!wince*:warning("DEPLOYMENT support required. This project only works on Symbian and WinCE.") + +QT += declarative network +SOURCES += $$PWD/qmlphotoviewer.cpp +include($$PWD/deployment.pri) + +symbian { + TARGET.UID3 = 0x$$qmlphotoviewer_uid3 # defined in deployment.pri + CONFIG += qt_demo + TARGET.CAPABILITY = NetworkServices + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 +} diff --git a/examples/embedded/qmltwitter/deployment.pri b/examples/embedded/qmltwitter/deployment.pri new file mode 100644 index 0000000000..3edc0e527c --- /dev/null +++ b/examples/embedded/qmltwitter/deployment.pri @@ -0,0 +1,8 @@ +qmltwitter_src = $$PWD/../../declarative/twitter +symbian { + load(data_caging_paths) + qmltwitter_uid3 = A000E401 + qmltwitter_files.path = $$APP_PRIVATE_DIR_BASE/$$qmltwitter_uid3 +} +qmltwitter_files.files = $$qmltwitter_src/twitter.qml $$qmltwitter_src/TwitterCore +DEPLOYMENT += qmltwitter_files diff --git a/examples/embedded/qmltwitter/qmltwitter.cpp b/examples/embedded/qmltwitter/qmltwitter.cpp new file mode 100644 index 0000000000..f63f9055ef --- /dev/null +++ b/examples/embedded/qmltwitter/qmltwitter.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Factory to create QNetworkAccessManagers that use the saved network configuration; otherwise +// the system default. +class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory +{ +public: + ~NetworkAccessManagerFactory() { } + + QNetworkAccessManager *create(QObject *parent); +}; + +QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) +{ + QNetworkAccessManager *accessManager = new QNetworkAccessManager(parent); + + QNetworkConfigurationManager manager; + if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) { + // Get saved network configuration + QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); + settings.beginGroup(QLatin1String("QtNetwork")); + const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString(); + settings.endGroup(); + + // If the saved network configuration is not currently discovered use the system default + QNetworkConfiguration config = manager.configurationFromIdentifier(id); + if ((config.state() & QNetworkConfiguration::Discovered) != + QNetworkConfiguration::Discovered) { + config = manager.defaultConfiguration(); + } + + accessManager->setConfiguration(config); + } + + return accessManager; +} + +int main(int argc, char *argv[]) +{ + QApplication application(argc, argv); + + NetworkAccessManagerFactory networkAccessManagerFactory; + + const QString mainQmlApp = QLatin1String("twitter.qml"); + QDeclarativeView view; + view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory); + view.setSource(QUrl(mainQmlApp)); + view.setResizeMode(QDeclarativeView::SizeRootObjectToView); + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); + +#if defined(Q_OS_SYMBIAN) + view.showFullScreen(); +#else // Q_OS_SYMBIAN + view.setGeometry(QRect(100, 100, 360, 640)); + view.show(); +#endif // Q_OS_SYMBIAN + return application.exec(); +} + diff --git a/examples/embedded/qmltwitter/qmltwitter.pro b/examples/embedded/qmltwitter/qmltwitter.pro new file mode 100644 index 0000000000..197afd3431 --- /dev/null +++ b/examples/embedded/qmltwitter/qmltwitter.pro @@ -0,0 +1,12 @@ +!symbian:!wince*:warning("DEPLOYMENT support required. This project only works on Symbian and WinCE.") + +QT += declarative network +SOURCES += $$PWD/qmltwitter.cpp +include($$PWD/deployment.pri) + +symbian { + TARGET.UID3 = 0x$$qmltwitter_uid3 # defined in deployment.pri + CONFIG += qt_demo + TARGET.CAPABILITY = NetworkServices + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 +} diff --git a/qtdeclarative.pro b/qtdeclarative.pro index 678fdf3398..084a7200c5 100644 --- a/qtdeclarative.pro +++ b/qtdeclarative.pro @@ -7,13 +7,6 @@ module_qtdeclarative_tools.subdir = tools module_qtdeclarative_tools.target = module-qtdeclarative-tools module_qtdeclarative_tools.depends = module_qtdeclarative_src -module_qtdeclarative_demos.subdir = demos -module_qtdeclarative_demos.target = module-qtdeclarative-demos -module_qtdeclarative_demos.depends = module_qtdeclarative_src -!contains(QT_BUILD_PARTS,demos) { - module_qtdeclarative_demos.CONFIG = no_default_target no_default_install -} - module_qtdeclarative_examples.subdir = examples/declarative module_qtdeclarative_examples.target = module-qtdeclarative-examples module_qtdeclarative_examples.depends = module_qtdeclarative_src @@ -29,6 +22,5 @@ module_qtdeclarative_tests.CONFIG = no_default_install SUBDIRS += module_qtdeclarative_src \ module_qtdeclarative_tools \ - module_qtdeclarative_demos \ module_qtdeclarative_examples \ module_qtdeclarative_tests \ -- cgit v1.2.3