diff options
author | axis <qt-info@nokia.com> | 2010-03-11 09:15:55 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2010-03-11 09:42:47 (GMT) |
commit | a375537d32bc33ba1154ec132f99f5a779bce067 (patch) | |
tree | 3c23e3b2c44fb52d7d62036fe7dd793e589841e8 /demos | |
parent | 02f6da62a42bd1059eb0da091d1f46efbb919750 (diff) | |
parent | 1e9552f826c05bf9884fb2893dedca265ead363b (diff) | |
download | Qt-a375537d32bc33ba1154ec132f99f5a779bce067.zip Qt-a375537d32bc33ba1154ec132f99f5a779bce067.tar.gz Qt-a375537d32bc33ba1154ec132f99f5a779bce067.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public
Conflicts:
mkspecs/common/symbian/symbian.conf
qmake/generators/makefile.h
qmake/project.cpp
src/3rdparty/webkit/WebCore/WebCore.pro
src/src.pro
Diffstat (limited to 'demos')
-rw-r--r-- | demos/declarative/declarative.pro | 17 | ||||
-rw-r--r-- | demos/declarative/flickr/common/ImageDetails.qml | 5 | ||||
-rw-r--r-- | demos/declarative/flickr/common/Loading.qml | 2 | ||||
-rw-r--r-- | demos/declarative/flickr/flickr-mobile-90.qml | 1 | ||||
-rw-r--r-- | demos/declarative/flickr/mobile/GridDelegate.qml | 2 | ||||
-rw-r--r-- | demos/declarative/flickr/mobile/ImageDetails.qml | 7 | ||||
-rw-r--r-- | demos/declarative/flickr/mobile/ListDelegate.qml | 4 | ||||
-rw-r--r-- | demos/declarative/minehunt/Description.qml | 34 | ||||
-rw-r--r-- | demos/declarative/minehunt/MinehuntCore/Explosion.qml (renamed from demos/declarative/minehunt/Explosion.qml) | 0 | ||||
-rw-r--r-- | demos/declarative/minehunt/MinehuntCore/pics/No-Ones-Laughing-3.jpg (renamed from demos/declarative/minehunt/pics/No-Ones-Laughing-3.jpg) | bin | 30730 -> 30730 bytes | |||
-rw-r--r-- | demos/declarative/minehunt/MinehuntCore/pics/back.png (renamed from demos/declarative/minehunt/pics/back.png) | bin | 558 -> 558 bytes | |||
-rw-r--r-- | demos/declarative/minehunt/MinehuntCore/pics/bomb-color.png (renamed from demos/declarative/minehunt/pics/bomb-color.png) | bin | 284 -> 284 bytes | |||
-rw-r--r-- | demos/declarative/minehunt/MinehuntCore/pics/bomb.png (renamed from demos/declarative/minehunt/pics/bomb.png) | bin | 535 -> 535 bytes | |||
-rw-r--r-- | demos/declarative/minehunt/MinehuntCore/pics/face-sad.png (renamed from demos/declarative/minehunt/pics/face-sad.png) | bin | 14844 -> 14844 bytes | |||
-rw-r--r-- | demos/declarative/minehunt/MinehuntCore/pics/face-smile-big.png (renamed from demos/declarative/minehunt/pics/face-smile-big.png) | bin | 13810 -> 13810 bytes | |||
-rw-r--r-- | demos/declarative/minehunt/MinehuntCore/pics/face-smile.png (renamed from demos/declarative/minehunt/pics/face-smile.png) | bin | 15408 -> 15408 bytes | |||
-rw-r--r-- | demos/declarative/minehunt/MinehuntCore/pics/flag-color.png (renamed from demos/declarative/minehunt/pics/flag-color.png) | bin | 219 -> 219 bytes | |||
-rw-r--r-- | demos/declarative/minehunt/MinehuntCore/pics/flag.png (renamed from demos/declarative/minehunt/pics/flag.png) | bin | 196 -> 196 bytes | |||
-rw-r--r-- | demos/declarative/minehunt/MinehuntCore/pics/front.png (renamed from demos/declarative/minehunt/pics/front.png) | bin | 580 -> 580 bytes | |||
-rw-r--r-- | demos/declarative/minehunt/MinehuntCore/pics/star.png (renamed from demos/declarative/minehunt/pics/star.png) | bin | 2677 -> 2677 bytes | |||
-rw-r--r-- | demos/declarative/minehunt/MinehuntCore/qmldir | 2 | ||||
-rw-r--r-- | demos/declarative/minehunt/README | 3 | ||||
-rw-r--r-- | demos/declarative/minehunt/minehunt.cpp (renamed from demos/declarative/minehunt/main.cpp) | 138 | ||||
-rw-r--r-- | demos/declarative/minehunt/minehunt.pro | 30 | ||||
-rw-r--r-- | demos/declarative/minehunt/minehunt.qml | 40 | ||||
-rw-r--r-- | demos/declarative/minehunt/test.qml | 13 | ||||
-rw-r--r-- | demos/declarative/samegame/SamegameCore/BoomBlock.qml (renamed from demos/declarative/samegame/content/BoomBlock.qml) | 6 | ||||
-rw-r--r-- | demos/declarative/samegame/SamegameCore/Button.qml (renamed from demos/declarative/samegame/content/Button.qml) | 0 | ||||
-rw-r--r-- | demos/declarative/samegame/SamegameCore/Dialog.qml (renamed from demos/declarative/samegame/content/Dialog.qml) | 2 | ||||
-rw-r--r-- | demos/declarative/samegame/SamegameCore/pics/background.png (renamed from demos/declarative/samegame/content/pics/background.png) | bin | 313930 -> 313930 bytes | |||
-rw-r--r-- | demos/declarative/samegame/SamegameCore/pics/blueStar.png (renamed from demos/declarative/samegame/content/pics/blueStar.png) | bin | 278 -> 278 bytes | |||
-rw-r--r-- | demos/declarative/samegame/SamegameCore/pics/blueStone.png (renamed from demos/declarative/samegame/content/pics/blueStone.png) | bin | 3054 -> 3054 bytes | |||
-rw-r--r-- | demos/declarative/samegame/SamegameCore/pics/greenStar.png (renamed from demos/declarative/samegame/content/pics/greenStar.png) | bin | 273 -> 273 bytes | |||
-rw-r--r-- | demos/declarative/samegame/SamegameCore/pics/greenStone.png (renamed from demos/declarative/samegame/content/pics/greenStone.png) | bin | 2932 -> 2932 bytes | |||
-rw-r--r-- | demos/declarative/samegame/SamegameCore/pics/redStar.png (renamed from demos/declarative/samegame/content/pics/redStar.png) | bin | 274 -> 274 bytes | |||
-rw-r--r-- | demos/declarative/samegame/SamegameCore/pics/redStone.png (renamed from demos/declarative/samegame/content/pics/redStone.png) | bin | 2902 -> 2902 bytes | |||
-rw-r--r-- | demos/declarative/samegame/SamegameCore/pics/star.png (renamed from demos/declarative/samegame/content/pics/star.png) | bin | 262 -> 262 bytes | |||
-rw-r--r-- | demos/declarative/samegame/SamegameCore/pics/yellowStone.png (renamed from demos/declarative/samegame/content/pics/yellowStone.png) | bin | 3056 -> 3056 bytes | |||
-rw-r--r-- | demos/declarative/samegame/SamegameCore/qmldir (renamed from demos/declarative/samegame/content/qmldir) | 0 | ||||
-rwxr-xr-x | demos/declarative/samegame/SamegameCore/samegame.js (renamed from demos/declarative/samegame/content/samegame.js) | 2 | ||||
-rw-r--r-- | demos/declarative/samegame/samegame.qml | 8 | ||||
-rw-r--r-- | demos/declarative/snake/content/Cookie.qml | 2 | ||||
-rw-r--r-- | demos/declarative/snake/content/Link.qml | 8 | ||||
-rw-r--r-- | demos/declarative/snake/content/Skull.qml | 6 | ||||
-rw-r--r-- | demos/declarative/snake/content/snake.js | 4 | ||||
-rw-r--r-- | demos/declarative/snake/snake.qml | 6 | ||||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/AuthView.qml (renamed from demos/declarative/twitter/content/AuthView.qml) | 0 | ||||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/Button.qml (renamed from demos/declarative/twitter/content/Button.qml) | 0 | ||||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/FatDelegate.qml (renamed from demos/declarative/twitter/content/FatDelegate.qml) | 2 | ||||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/HomeTitleBar.qml (renamed from demos/declarative/twitter/content/HomeTitleBar.qml) | 0 | ||||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/Loading.qml (renamed from demos/declarative/twitter/content/Loading.qml) | 2 | ||||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/MultiTitleBar.qml (renamed from demos/declarative/twitter/content/MultiTitleBar.qml) | 0 | ||||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/RssModel.qml (renamed from demos/declarative/twitter/content/RssModel.qml) | 0 | ||||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/TitleBar.qml (renamed from demos/declarative/twitter/content/TitleBar.qml) | 0 | ||||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/ToolBar.qml (renamed from demos/declarative/twitter/content/ToolBar.qml) | 0 | ||||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/UserModel.qml (renamed from demos/declarative/twitter/content/UserModel.qml) | 0 | ||||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/images/gloss.png (renamed from demos/declarative/twitter/content/images/gloss.png) | bin | 1236 -> 1236 bytes | |||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/images/lineedit.png (renamed from demos/declarative/twitter/content/images/lineedit.png) | bin | 1415 -> 1415 bytes | |||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/images/lineedit.sci (renamed from demos/declarative/twitter/content/images/lineedit.sci) | 0 | ||||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/images/loading.png (renamed from demos/declarative/twitter/content/images/loading.png) | bin | 813 -> 813 bytes | |||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/images/stripes.png (renamed from demos/declarative/twitter/content/images/stripes.png) | bin | 257 -> 257 bytes | |||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/images/titlebar.png (renamed from demos/declarative/twitter/content/images/titlebar.png) | bin | 1436 -> 1436 bytes | |||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/images/titlebar.sci (renamed from demos/declarative/twitter/content/images/titlebar.sci) | 0 | ||||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/images/toolbutton.png (renamed from demos/declarative/twitter/content/images/toolbutton.png) | bin | 2550 -> 2550 bytes | |||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/images/toolbutton.sci (renamed from demos/declarative/twitter/content/images/toolbutton.sci) | 0 | ||||
-rw-r--r-- | demos/declarative/twitter/TwitterCore/qmldir | 10 | ||||
-rw-r--r-- | demos/declarative/twitter/twitter.qml | 6 | ||||
-rw-r--r-- | demos/declarative/webbrowser/content/FlickableWebView.qml | 2 | ||||
-rw-r--r-- | demos/declarative/webbrowser/content/fieldtext/FieldText.qml | 2 | ||||
-rw-r--r-- | demos/declarative/webbrowser/webbrowser.qml | 1 | ||||
-rw-r--r-- | demos/demos.pro | 2 | ||||
-rw-r--r-- | demos/interview/model.cpp | 2 | ||||
-rw-r--r-- | demos/interview/model.h | 2 | ||||
-rw-r--r-- | demos/mainwindow/mainwindow.cpp | 2 | ||||
-rw-r--r-- | demos/multimedia/player/player.cpp | 28 | ||||
-rw-r--r-- | demos/multimedia/player/player.h | 3 | ||||
-rw-r--r-- | demos/qtdemo/qtdemo.pro | 2 | ||||
-rw-r--r-- | demos/spreadsheet/spreadsheet.cpp | 1 | ||||
-rw-r--r-- | demos/sqlbrowser/browser.cpp | 2 |
79 files changed, 203 insertions, 208 deletions
diff --git a/demos/declarative/declarative.pro b/demos/declarative/declarative.pro new file mode 100644 index 0000000..4d169e3 --- /dev/null +++ b/demos/declarative/declarative.pro @@ -0,0 +1,17 @@ +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 \ + samegame \ + snake \ + twitter \ + webbrowser +sources.path = $$[QT_INSTALL_DEMOS]/declarative +INSTALLS += sources + diff --git a/demos/declarative/flickr/common/ImageDetails.qml b/demos/declarative/flickr/common/ImageDetails.qml index f91b365..862eeb1 100644 --- a/demos/declarative/flickr/common/ImageDetails.qml +++ b/demos/declarative/flickr/common/ImageDetails.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 Flipable { id: container @@ -93,9 +94,7 @@ Flipable { Image { id: bigImage; source: container.photoUrl; scale: slider.value - // Center image if it is smaller than the flickable area. - x: imageContainer.width > width*scale ? (imageContainer.width - width*scale) / 2 : 0 - y: imageContainer.height > height*scale ? (imageContainer.height - height*scale) / 2 : 0 + anchors.centerIn: parent; smooth: !flick.moving onStatusChanged : { // Default scale shows the entire image. diff --git a/demos/declarative/flickr/common/Loading.qml b/demos/declarative/flickr/common/Loading.qml index 174cd21..938a080 100644 --- a/demos/declarative/flickr/common/Loading.qml +++ b/demos/declarative/flickr/common/Loading.qml @@ -2,7 +2,7 @@ import Qt 4.6 Image { id: loading; source: "pics/loading.png"; transformOrigin: "Center" - rotation: NumberAnimation { + NumberAnimation on rotation { from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 } } diff --git a/demos/declarative/flickr/flickr-mobile-90.qml b/demos/declarative/flickr/flickr-mobile-90.qml index 259ff10..9fec242 100644 --- a/demos/declarative/flickr/flickr-mobile-90.qml +++ b/demos/declarative/flickr/flickr-mobile-90.qml @@ -5,6 +5,7 @@ Item { Loader { y: 320; rotation: -90 + transformOrigin: Item.TopLeft source: "flickr-mobile.qml" } } diff --git a/demos/declarative/flickr/mobile/GridDelegate.qml b/demos/declarative/flickr/mobile/GridDelegate.qml index 7634573..291d874 100644 --- a/demos/declarative/flickr/mobile/GridDelegate.qml +++ b/demos/declarative/flickr/mobile/GridDelegate.qml @@ -23,7 +23,7 @@ Item { anchors.centerIn: parent scale: 0.0 - scale: Behavior { NumberAnimation { easing.type: "InOutQuad"} } + Behavior on scale { NumberAnimation { easing.type: "InOutQuad"} } id: scaleMe Rectangle { height: 79; width: 79; id: blackRect; anchors.centerIn: parent; color: "black"; smooth: true } diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index 8749b4c..2f4df8a 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -45,7 +45,7 @@ Flipable { Text { color: "white"; elide: Text.ElideRight; text: "<b>Author:</b> " + container.photoAuthor } Text { color: "white"; elide: Text.ElideRight; text: "<b>Published:</b> " + container.photoDate } Text { color: "white"; elide: Text.ElideRight; text: container.photoTags == "" ? "" : "<b>Tags:</b> " } - Text { color: "white"; elide: Text.ElideRight; elide: Text.ElideRight; text: container.photoTags } + Text { color: "white"; elide: Text.ElideRight; text: container.photoTags } } } @@ -66,10 +66,7 @@ Flipable { Image { id: bigImage; source: container.photoUrl; scale: slider.value - // Center image if it is smaller than the flickable area. - x: imageContainer.width > width*scale ? (imageContainer.width - width*scale) / 2 : 0 - y: imageContainer.height > height*scale ? (imageContainer.height - height*scale) / 2 : 0 - smooth: !flickable.moving + anchors.centerIn: parent; smooth: !flickable.moving onStatusChanged : { // Default scale shows the entire image. if (status == 1 && width != 0) { diff --git a/demos/declarative/flickr/mobile/ListDelegate.qml b/demos/declarative/flickr/mobile/ListDelegate.qml index 75c4572..381664b 100644 --- a/demos/declarative/flickr/mobile/ListDelegate.qml +++ b/demos/declarative/flickr/mobile/ListDelegate.qml @@ -15,8 +15,8 @@ Component { Column { x: 92; width: wrapper.ListView.view.width - 95; y: 15; spacing: 2 Text { text: title; color: "white"; width: parent.width; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" } - Text { text: photoAuthor; color: "white"; width: parent.width; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" } - Text { text: photoDate; color: "white"; width: parent.width; elide: Text.ElideRight; color: "#cccccc"; style: Text.Raised; styleColor: "black" } + Text { text: photoAuthor; width: parent.width; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" } + Text { text: photoDate; width: parent.width; elide: Text.ElideRight; color: "#cccccc"; style: Text.Raised; styleColor: "black" } } } } diff --git a/demos/declarative/minehunt/Description.qml b/demos/declarative/minehunt/Description.qml deleted file mode 100644 index cc4d3b2..0000000 --- a/demos/declarative/minehunt/Description.qml +++ /dev/null @@ -1,34 +0,0 @@ -import Qt 4.6 - -Item { - id: page - height: myText.height + 20 - property var text - MouseArea { - anchors.fill: parent - drag.target: page - drag.axis: "XandYAxis" - drag.minimumX: 0 - drag.maximumX: 1000 - drag.minimumY: 0 - drag.maximumY: 1000 - } - Rectangle { - radius: 10 - anchors.fill: parent - color: "lightsteelblue" - } - Item { - x: 10 - y: 10 - width: parent.width - 20 - height: parent.height - 20 - Text { - id: myText - text: page.text - width: parent.width - clip: true - wrap: true - } - } -} diff --git a/demos/declarative/minehunt/Explosion.qml b/demos/declarative/minehunt/MinehuntCore/Explosion.qml index e337c46..e337c46 100644 --- a/demos/declarative/minehunt/Explosion.qml +++ b/demos/declarative/minehunt/MinehuntCore/Explosion.qml diff --git a/demos/declarative/minehunt/pics/No-Ones-Laughing-3.jpg b/demos/declarative/minehunt/MinehuntCore/pics/No-Ones-Laughing-3.jpg Binary files differindex 445567f..445567f 100644 --- a/demos/declarative/minehunt/pics/No-Ones-Laughing-3.jpg +++ b/demos/declarative/minehunt/MinehuntCore/pics/No-Ones-Laughing-3.jpg diff --git a/demos/declarative/minehunt/pics/back.png b/demos/declarative/minehunt/MinehuntCore/pics/back.png Binary files differindex f6b3f0b..f6b3f0b 100644 --- a/demos/declarative/minehunt/pics/back.png +++ b/demos/declarative/minehunt/MinehuntCore/pics/back.png diff --git a/demos/declarative/minehunt/pics/bomb-color.png b/demos/declarative/minehunt/MinehuntCore/pics/bomb-color.png Binary files differindex 61ad0a9..61ad0a9 100644 --- a/demos/declarative/minehunt/pics/bomb-color.png +++ b/demos/declarative/minehunt/MinehuntCore/pics/bomb-color.png diff --git a/demos/declarative/minehunt/pics/bomb.png b/demos/declarative/minehunt/MinehuntCore/pics/bomb.png Binary files differindex a992575..a992575 100644 --- a/demos/declarative/minehunt/pics/bomb.png +++ b/demos/declarative/minehunt/MinehuntCore/pics/bomb.png diff --git a/demos/declarative/minehunt/pics/face-sad.png b/demos/declarative/minehunt/MinehuntCore/pics/face-sad.png Binary files differindex cf00aaf..cf00aaf 100644 --- a/demos/declarative/minehunt/pics/face-sad.png +++ b/demos/declarative/minehunt/MinehuntCore/pics/face-sad.png diff --git a/demos/declarative/minehunt/pics/face-smile-big.png b/demos/declarative/minehunt/MinehuntCore/pics/face-smile-big.png Binary files differindex f9c2335..f9c2335 100644 --- a/demos/declarative/minehunt/pics/face-smile-big.png +++ b/demos/declarative/minehunt/MinehuntCore/pics/face-smile-big.png diff --git a/demos/declarative/minehunt/pics/face-smile.png b/demos/declarative/minehunt/MinehuntCore/pics/face-smile.png Binary files differindex 3d66d72..3d66d72 100644 --- a/demos/declarative/minehunt/pics/face-smile.png +++ b/demos/declarative/minehunt/MinehuntCore/pics/face-smile.png diff --git a/demos/declarative/minehunt/pics/flag-color.png b/demos/declarative/minehunt/MinehuntCore/pics/flag-color.png Binary files differindex aadad0f..aadad0f 100644 --- a/demos/declarative/minehunt/pics/flag-color.png +++ b/demos/declarative/minehunt/MinehuntCore/pics/flag-color.png diff --git a/demos/declarative/minehunt/pics/flag.png b/demos/declarative/minehunt/MinehuntCore/pics/flag.png Binary files differindex 39cde4d..39cde4d 100644 --- a/demos/declarative/minehunt/pics/flag.png +++ b/demos/declarative/minehunt/MinehuntCore/pics/flag.png diff --git a/demos/declarative/minehunt/pics/front.png b/demos/declarative/minehunt/MinehuntCore/pics/front.png Binary files differindex 834331b..834331b 100644 --- a/demos/declarative/minehunt/pics/front.png +++ b/demos/declarative/minehunt/MinehuntCore/pics/front.png diff --git a/demos/declarative/minehunt/pics/star.png b/demos/declarative/minehunt/MinehuntCore/pics/star.png Binary files differindex 3772359..3772359 100644 --- a/demos/declarative/minehunt/pics/star.png +++ b/demos/declarative/minehunt/MinehuntCore/pics/star.png diff --git a/demos/declarative/minehunt/MinehuntCore/qmldir b/demos/declarative/minehunt/MinehuntCore/qmldir new file mode 100644 index 0000000..862c396 --- /dev/null +++ b/demos/declarative/minehunt/MinehuntCore/qmldir @@ -0,0 +1,2 @@ +plugin minehunt +Explosion 1.0 Explosion.qml diff --git a/demos/declarative/minehunt/README b/demos/declarative/minehunt/README new file mode 100644 index 0000000..7379dcf --- /dev/null +++ b/demos/declarative/minehunt/README @@ -0,0 +1,3 @@ +To run, simply load the minehunt.qml file with the qml runtime. + +Note that on X11, this demo has problems with the native graphicssystem. If you are using the X11 window system, please pass -graphicssystem raster to the qml binary. diff --git a/demos/declarative/minehunt/main.cpp b/demos/declarative/minehunt/minehunt.cpp index 0e99731..89845ef 100644 --- a/demos/declarative/minehunt/main.cpp +++ b/demos/declarative/minehunt/minehunt.cpp @@ -38,21 +38,15 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "qdeclarativeengine.h" -#include "qdeclarativecontext.h" -#include "qdeclarative.h" -#include <qdeclarativeitem.h> -#include <qdeclarativeview.h> - -#include <QWidget> -#include <QApplication> -#include <QFile> + +#include <stdlib.h> +#include <qdeclarativeextensionplugin.h> +#include <qdeclarativecontext.h> +#include <qdeclarativeengine.h> +#include <qdeclarative.h> + #include <QTime> #include <QTimer> -#include <QVBoxLayout> -#include <QFileInfo> - -QString fileName = "minehunt.qml"; class Tile : public QObject { @@ -91,17 +85,14 @@ private: bool _flipped; }; -QML_DECLARE_TYPE(Tile); - -class MyWidget : public QWidget +class MinehuntGame : public QObject { -Q_OBJECT + Q_OBJECT public: - MyWidget(int = 370, int = 480, QWidget *parent=0, Qt::WindowFlags flags=0); - ~MyWidget(); + MinehuntGame(); - Q_PROPERTY(QList<Tile *> *tiles READ tiles CONSTANT); - QList<Tile *> *tiles() { return &_tiles; } + Q_PROPERTY(QDeclarativeListProperty<Tile> tiles READ tiles CONSTANT); + QDeclarativeListProperty<Tile> tiles() { return QDeclarativeListProperty<Tile>(this, _tiles); } Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY isPlayingChanged); bool isPlaying() {return playing;} @@ -116,8 +107,8 @@ public: int numFlags() const{return nFlags;} public slots: - Q_INVOKABLE void flip(int row, int col); - Q_INVOKABLE void flag(int row, int col); + Q_INVOKABLE bool flip(int row, int col); + Q_INVOKABLE bool flag(int row, int col); void setBoard(); void reset(); @@ -133,8 +124,6 @@ private: int getHint(int row, int col); void setPlaying(bool b){if(b==playing) return; playing=b; emit isPlayingChanged();} - QDeclarativeView *canvas; - QList<Tile *> _tiles; int numCols; int numRows; @@ -145,39 +134,21 @@ private: int nFlags; }; -MyWidget::MyWidget(int width, int height, QWidget *parent, Qt::WindowFlags flags) -: QWidget(parent, flags), canvas(0), numCols(9), numRows(9), playing(true), won(false) +MinehuntGame::MinehuntGame() +: numCols(9), numRows(9), playing(true), won(false) { - setObjectName("mainWidget"); + setObjectName("mainObject"); srand(QTime(0,0,0).secsTo(QTime::currentTime())); //initialize array for(int ii = 0; ii < numRows * numCols; ++ii) { _tiles << new Tile; } - reset(); - QVBoxLayout *vbox = new QVBoxLayout; - vbox->setMargin(0); - setLayout(vbox); - - canvas = new QDeclarativeView(this); - canvas->setFixedSize(width, height); - vbox->addWidget(canvas); - - QDeclarativeContext *ctxt = canvas->rootContext(); - ctxt->addDefaultObject(this); - ctxt->setContextProperty("tiles", QVariant::fromValue<QList<Tile*>*>(&_tiles));//QTBUG-5675 - - canvas->setSource(QUrl::fromLocalFile(fileName)); -} - -MyWidget::~MyWidget() -{ } -void MyWidget::setBoard() +void MinehuntGame::setBoard() { foreach(Tile* t, _tiles){ t->setHasMine(false); @@ -211,7 +182,7 @@ void MyWidget::setBoard() setPlaying(true); } -void MyWidget::reset() +void MinehuntGame::reset() { foreach(Tile* t, _tiles){ t->unflip(); @@ -223,7 +194,7 @@ void MyWidget::reset() QTimer::singleShot(600,this, SLOT(setBoard())); } -int MyWidget::getHint(int row, int col) +int MinehuntGame::getHint(int row, int col) { int hint = 0; for (int c = col-1; c <= col+1; c++) @@ -235,14 +206,14 @@ int MyWidget::getHint(int row, int col) return hint; } -void MyWidget::flip(int row, int col) +bool MinehuntGame::flip(int row, int col) { if(!playing) - return; + return false; Tile *t = tile(row, col); if (!t || t->hasFlag()) - return; + return false; if(t->flipped()){ int flags = 0; @@ -255,7 +226,7 @@ void MyWidget::flip(int row, int col) flags++; } if(!t->hint() || t->hint() != flags) - return; + return false; for (int c = col-1; c <= col+1; c++) for (int r = row-1; r <= row+1; r++) { Tile *nearT = tile(r, c); @@ -263,7 +234,7 @@ void MyWidget::flip(int row, int col) flip( r, c ); } } - return; + return true; } t->flip(); @@ -297,50 +268,47 @@ void MyWidget::flip(int row, int col) hasWonChanged(); setPlaying(false); } + return true; } -void MyWidget::flag(int row, int col) +bool MinehuntGame::flag(int row, int col) { Tile *t = tile(row, col); if(!t) - return; + return false; t->setHasFlag(!t->hasFlag()); nFlags += (t->hasFlag()?1:-1); emit numFlagsChanged(); + return true; } -///////////////////////////////////////////////////////// -int main(int argc, char ** argv) +QML_DECLARE_TYPE(Tile); +QML_DECLARE_TYPE(MinehuntGame); + +class MinehuntExtensionPlugin : public QDeclarativeExtensionPlugin { - QApplication app(argc, argv); - - bool frameless = false; - - int width = 370; - int height = 480; - - QML_REGISTER_TYPE(0,0,0,Tile,Tile); - - for (int i = 1; i < argc; ++i) { - QString arg = argv[i]; - if (arg == "-frameless") { - frameless = true; - } else if(arg == "-width" && i < (argc - 1)) { - ++i; - width = ::atoi(argv[i]); - } else if(arg == "-height" && i < (argc - 1)) { - ++i; - height = ::atoi(argv[i]); - } else if (arg[0] != '-') { - fileName = arg; - } + Q_OBJECT + + public: + void registerTypes(const char *uri) { + Q_UNUSED(uri); + QML_REGISTER_TYPE(SameGameCore, 0, 1, Tile, Tile); + QML_REGISTER_TYPE(SameGameCore, 0, 1, Game, MinehuntGame); } - MyWidget wid(width, height, 0, frameless ? Qt::FramelessWindowHint : Qt::Widget); - wid.show(); + void initializeEngine(QDeclarativeEngine *engine, const char *uri) { + Q_UNUSED(uri); - return app.exec(); -} + srand(QTime(0,0,0).secsTo(QTime::currentTime())); + + MinehuntGame* game = new MinehuntGame(); + + engine->rootContext()->addDefaultObject(game); + } +}; + +#include "minehunt.moc" + +Q_EXPORT_PLUGIN(MinehuntExtensionPlugin); -#include "main.moc" diff --git a/demos/declarative/minehunt/minehunt.pro b/demos/declarative/minehunt/minehunt.pro index 01791b1..2df33e6 100644 --- a/demos/declarative/minehunt/minehunt.pro +++ b/demos/declarative/minehunt/minehunt.pro @@ -1,9 +1,25 @@ -SOURCES = main.cpp +TEMPLATE = lib +TARGET = minehunt +QT += declarative +CONFIG += qt plugin -QT += script declarative -contains(QT_CONFIG, opengles2)|contains(QT_CONFIG, opengles1): QT += opengl +TARGET = $$qtLibraryTarget($$TARGET) +DESTDIR = MinehuntCore + +# Input +SOURCES += minehunt.cpp + + +sources.files = minehunt.qml minehunt.pro +sources.path = $$[QT_INSTALL_DEMOS]/declarative/minehunt + +target.path = $$[QT_INSTALL_DEMOS]/declarative/minehunt/MinehuntCore + +MinehuntCore_sources.files = \ + MinehuntCore/Explosion.qml \ + MinehuntCore/pics \ + MinehuntCore/qmldir +MinehuntCore_sources.path = $$[QT_INSTALL_DEMOS]/declarative/minehunt/MinehuntCore + +INSTALLS = sources MinehuntCore_sources target -target.path = $$[QT_INSTALL_EXAMPLES]/declarative/minehunt -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS minehunt.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/declarative/minehunt -INSTALLS += target sources diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index 617a6ed..9e99706 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import MinehuntCore 1.0 Item { id: field @@ -24,15 +25,15 @@ Item { angle: flipable.angle; } front: Image { - source: "pics/front.png" + source: "MinehuntCore/pics/front.png" width: 40 height: 40 Image { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - source: "pics/flag.png" - opacity: model.hasFlag - opacity: Behavior { + source: "MinehuntCore/pics/flag.png" + opacity: modelData.hasFlag + Behavior on opacity { NumberAnimation { property: "opacity" duration: 250 @@ -41,22 +42,22 @@ Item { } } back: Image { - source: "pics/back.png" + source: "MinehuntCore/pics/back.png" width: 40 height: 40 Text { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - text: model.hint + text: modelData.hint color: "white" font.bold: true - opacity: !model.hasMine && model.hint > 0 + opacity: !modelData.hasMine && modelData.hint > 0 } Image { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - source: "pics/bomb.png" - opacity: model.hasMine + source: "MinehuntCore/pics/bomb.png" + opacity: modelData.hasMine } Explosion { id: expl @@ -65,7 +66,7 @@ Item { states: [ State { name: "back" - when: model.flipped + when: modelData.flipped PropertyChanges { target: flipable; angle: 180 } } ] @@ -81,7 +82,7 @@ Item { else ret = 0; if (ret > 0) { - if (model.hasMine && model.flipped) { + if (modelData.hasMine && modelData.flipped) { ret*3; } else { ret; @@ -96,7 +97,7 @@ Item { properties: "angle" } ScriptAction{ - script: if(model.hasMine && model.flipped){expl.explode = true;} + script: if(modelData.hasMine && modelData.flipped){expl.explode = true;} } } } @@ -120,16 +121,9 @@ Item { } ] Image { - source: "pics/No-Ones-Laughing-3.jpg" + source: "MinehuntCore/pics/No-Ones-Laughing-3.jpg" fillMode: Image.Tile } - Description { - text: "Use the 'minehunt' executable to run this demo!" - width: 300 - opacity: tiles?0:1 - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - } Repeater { id: repeater model: tiles @@ -156,7 +150,7 @@ Item { Image { // x: 100 // y: 20 - source: "pics/bomb-color.png" + source: "MinehuntCore/pics/bomb-color.png" } Text { // x: 100 @@ -172,7 +166,7 @@ Item { Image { // x: 140 // y: 20 - source: "pics/flag-color.png" + source: "MinehuntCore/pics/flag-color.png" } Text { // x: 140 @@ -187,7 +181,7 @@ Item { y: 390 anchors.right: field.right anchors.rightMargin: 20 - source: isPlaying ? 'pics/face-smile.png' : hasWon ? 'pics/face-smile-big.png': 'pics/face-sad.png' + 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() } diff --git a/demos/declarative/minehunt/test.qml b/demos/declarative/minehunt/test.qml deleted file mode 100644 index 11ed182..0000000 --- a/demos/declarative/minehunt/test.qml +++ /dev/null @@ -1,13 +0,0 @@ -import Qt 4.6 - - Image { - source: "pics/front.png" - width: 40 - height: 40 - Image { - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - source: "pics/flag.png" - opacity: 1 - } - } diff --git a/demos/declarative/samegame/content/BoomBlock.qml b/demos/declarative/samegame/SamegameCore/BoomBlock.qml index 723e62a..e48194a 100644 --- a/demos/declarative/samegame/content/BoomBlock.qml +++ b/demos/declarative/samegame/SamegameCore/BoomBlock.qml @@ -7,8 +7,8 @@ Item { id:block property int targetX: 0 property int targetY: 0 - x: SpringFollow { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } - y: SpringFollow { source: targetY; spring: 2; damping: 0.2 } + SpringFollow on x { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } + SpringFollow on y { source: targetY; spring: 2; damping: 0.2 } Image { id: img source: { @@ -21,7 +21,7 @@ Item { id:block } } opacity: 0 - opacity: Behavior { NumberAnimation { duration: 200 } } + Behavior on opacity { NumberAnimation { duration: 200 } } anchors.fill: parent } diff --git a/demos/declarative/samegame/content/Button.qml b/demos/declarative/samegame/SamegameCore/Button.qml index 6629302..6629302 100644 --- a/demos/declarative/samegame/content/Button.qml +++ b/demos/declarative/samegame/SamegameCore/Button.qml diff --git a/demos/declarative/samegame/content/Dialog.qml b/demos/declarative/samegame/SamegameCore/Dialog.qml index 7769328..6d5d6b5 100644 --- a/demos/declarative/samegame/content/Dialog.qml +++ b/demos/declarative/samegame/SamegameCore/Dialog.qml @@ -14,7 +14,7 @@ Rectangle { property Item text: myText color: "white"; border.width: 1; width: myText.width + 20; height: myText.height + 40; opacity: 0 - opacity: Behavior { + Behavior on opacity { NumberAnimation { duration: 1000 } } Text { id: myText; anchors.centerIn: parent; text: "Hello World!" } diff --git a/demos/declarative/samegame/content/pics/background.png b/demos/declarative/samegame/SamegameCore/pics/background.png Binary files differindex 3734a27..3734a27 100644 --- a/demos/declarative/samegame/content/pics/background.png +++ b/demos/declarative/samegame/SamegameCore/pics/background.png diff --git a/demos/declarative/samegame/content/pics/blueStar.png b/demos/declarative/samegame/SamegameCore/pics/blueStar.png Binary files differindex ff9588f..ff9588f 100644 --- a/demos/declarative/samegame/content/pics/blueStar.png +++ b/demos/declarative/samegame/SamegameCore/pics/blueStar.png diff --git a/demos/declarative/samegame/content/pics/blueStone.png b/demos/declarative/samegame/SamegameCore/pics/blueStone.png Binary files differindex 20e43c7..20e43c7 100644 --- a/demos/declarative/samegame/content/pics/blueStone.png +++ b/demos/declarative/samegame/SamegameCore/pics/blueStone.png diff --git a/demos/declarative/samegame/content/pics/greenStar.png b/demos/declarative/samegame/SamegameCore/pics/greenStar.png Binary files differindex cd06854..cd06854 100644 --- a/demos/declarative/samegame/content/pics/greenStar.png +++ b/demos/declarative/samegame/SamegameCore/pics/greenStar.png diff --git a/demos/declarative/samegame/content/pics/greenStone.png b/demos/declarative/samegame/SamegameCore/pics/greenStone.png Binary files differindex b568a19..b568a19 100644 --- a/demos/declarative/samegame/content/pics/greenStone.png +++ b/demos/declarative/samegame/SamegameCore/pics/greenStone.png diff --git a/demos/declarative/samegame/content/pics/redStar.png b/demos/declarative/samegame/SamegameCore/pics/redStar.png Binary files differindex 0a4dffe..0a4dffe 100644 --- a/demos/declarative/samegame/content/pics/redStar.png +++ b/demos/declarative/samegame/SamegameCore/pics/redStar.png diff --git a/demos/declarative/samegame/content/pics/redStone.png b/demos/declarative/samegame/SamegameCore/pics/redStone.png Binary files differindex 36b09a2..36b09a2 100644 --- a/demos/declarative/samegame/content/pics/redStone.png +++ b/demos/declarative/samegame/SamegameCore/pics/redStone.png diff --git a/demos/declarative/samegame/content/pics/star.png b/demos/declarative/samegame/SamegameCore/pics/star.png Binary files differindex defbde5..defbde5 100644 --- a/demos/declarative/samegame/content/pics/star.png +++ b/demos/declarative/samegame/SamegameCore/pics/star.png diff --git a/demos/declarative/samegame/content/pics/yellowStone.png b/demos/declarative/samegame/SamegameCore/pics/yellowStone.png Binary files differindex b1ce762..b1ce762 100644 --- a/demos/declarative/samegame/content/pics/yellowStone.png +++ b/demos/declarative/samegame/SamegameCore/pics/yellowStone.png diff --git a/demos/declarative/samegame/content/qmldir b/demos/declarative/samegame/SamegameCore/qmldir index a8f8a98..a8f8a98 100644 --- a/demos/declarative/samegame/content/qmldir +++ b/demos/declarative/samegame/SamegameCore/qmldir diff --git a/demos/declarative/samegame/content/samegame.js b/demos/declarative/samegame/SamegameCore/samegame.js index c0f10bd..1214b79 100755 --- a/demos/declarative/samegame/content/samegame.js +++ b/demos/declarative/samegame/SamegameCore/samegame.js @@ -4,7 +4,7 @@ var maxX = 10;//Nums are for gameCanvas.tileSize 40 var maxY = 15; var maxIndex = maxX*maxY; var board = new Array(maxIndex); -var tileSrc = "content/BoomBlock.qml"; +var tileSrc = "SamegameCore/BoomBlock.qml"; var scoresURL = "http://qtfx-nokia.trolltech.com.au/samegame/scores.php"; var scoresURL = ""; var timer; diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml index 50f6293..3b19cbe 100644 --- a/demos/declarative/samegame/samegame.qml +++ b/demos/declarative/samegame/samegame.qml @@ -1,5 +1,5 @@ import Qt 4.6 -import "content" +import SamegameCore 1.0 Rectangle { id: screen @@ -12,7 +12,7 @@ Rectangle { Image { id: background - anchors.fill: parent; source: "content/pics/background.png" + anchors.fill: parent; source: "SamegameCore/pics/background.png" fillMode: Image.PreserveAspectCrop smooth: true } @@ -22,7 +22,7 @@ Rectangle { property int score: 0 property int tileSize: 40 - Script { source: "content/samegame.js" } + Script { source: "SamegameCore/samegame.js" } z: 20; anchors.centerIn: parent width: parent.width - (parent.width % getTileSize()); @@ -39,7 +39,7 @@ Rectangle { Dialog { id: scoreName; anchors.centerIn: parent; z: 22; property int initialWidth: 0 - width: Behavior{NumberAnimation{} enabled: initialWidth!=0} + Behavior on width {NumberAnimation{} enabled: initialWidth!=0} Text { id: spacer anchors.left: scoreName.left diff --git a/demos/declarative/snake/content/Cookie.qml b/demos/declarative/snake/content/Cookie.qml index 7f0aadf..0ea95cb 100644 --- a/demos/declarative/snake/content/Cookie.qml +++ b/demos/declarative/snake/content/Cookie.qml @@ -17,7 +17,7 @@ Item { anchors.fill: parent source: "pics/cookie.png" opacity: 0 - opacity: Behavior { NumberAnimation { duration: 100 } } + Behavior on opacity { NumberAnimation { duration: 100 } } Text { font.bold: true anchors.verticalCenter: parent.verticalCenter diff --git a/demos/declarative/snake/content/Link.qml b/demos/declarative/snake/content/Link.qml index 1b3f7bf..31ac4b9 100644 --- a/demos/declarative/snake/content/Link.qml +++ b/demos/declarative/snake/content/Link.qml @@ -13,8 +13,8 @@ Item { id:link x: margin - 3 + gridSize * column y: margin - 3 + gridSize * row - x: Behavior { NumberAnimation { duration: spawned ? heartbeatInterval : 0} } - y: Behavior { NumberAnimation { duration: spawned ? heartbeatInterval : 0 } } + Behavior on x { NumberAnimation { duration: spawned ? heartbeatInterval : 0} } + Behavior on y { NumberAnimation { duration: spawned ? heartbeatInterval : 0 } } Item { @@ -35,7 +35,7 @@ Item { id:link id: actualImageRotation origin.x: width/2; origin.y: height/2; angle: rotation * 90 - angle: Behavior{ NumberAnimation { duration: spawned ? 200 : 0} } + Behavior on angle { NumberAnimation { duration: spawned ? 200 : 0} } } } @@ -44,7 +44,7 @@ Item { id:link } opacity: 0 - opacity: Behavior { NumberAnimation { duration: 200 } } + Behavior on opacity { NumberAnimation { duration: 200 } } } diff --git a/demos/declarative/snake/content/Skull.qml b/demos/declarative/snake/content/Skull.qml index 585e7d3..821996a 100644 --- a/demos/declarative/snake/content/Skull.qml +++ b/demos/declarative/snake/content/Skull.qml @@ -9,11 +9,11 @@ Image { x: margin + column * gridSize + 2 y: margin + row * gridSize - 3 - x: Behavior { NumberAnimation { duration: spawned ? halfbeatInterval : 0} } - y: Behavior { NumberAnimation { duration: spawned ? halfbeatInterval : 0 } } + Behavior on x { NumberAnimation { duration: spawned ? halfbeatInterval : 0} } + Behavior on y { NumberAnimation { duration: spawned ? halfbeatInterval : 0 } } opacity: spawned ? 1 : 0 - opacity: Behavior { NumberAnimation { duration: 200 } } + Behavior on opacity { NumberAnimation { duration: 200 } } source: "pics/skull.png" width: 24 diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js index a65aebc..12176c7 100644 --- a/demos/declarative/snake/content/snake.js +++ b/demos/declarative/snake/content/snake.js @@ -54,7 +54,7 @@ function startNewGame() } else { if(linkComponent.isReady == false){ if(linkComponent.isError == true) - print(linkComponent.errorString()); + print(linkComponent.errorsString()); else print("Still loading linkComponent"); continue;//TODO: Better error handling? @@ -295,7 +295,7 @@ function createCookie(value) { if(cookieComponent.isReady == false){ if(cookieComponent.isError == true) - print(cookieComponent.errorString()); + print(cookieComponent.errorsString()); else print("Still loading cookieComponent"); return;//TODO: Better error handling? diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index 09b6b7f..f9d02c7 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -65,7 +65,7 @@ Rectangle { anchors.fill: parent anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - opacity: Behavior { NumberAnimation { duration: 500 } } + Behavior on opacity { NumberAnimation { duration: 500 } } Text { color: "white" @@ -121,7 +121,7 @@ Rectangle { Rectangle { id: progressBar opacity: 0 - opacity: Behavior { NumberAnimation { duration: 200 } } + Behavior on opacity { NumberAnimation { duration: 200 } } color: "transparent" border.width: 2 border.color: "#221edd" @@ -137,7 +137,7 @@ Rectangle { id: progressIndicator color: "#221edd"; width: 0; - width: Behavior { NumberAnimation { duration: startHeartbeatTimer.running ? 1000 : 0}} + Behavior on width { NumberAnimation { duration: startHeartbeatTimer.running ? 1000 : 0}} height: 30; } } diff --git a/demos/declarative/twitter/content/AuthView.qml b/demos/declarative/twitter/TwitterCore/AuthView.qml index bcf4646..bcf4646 100644 --- a/demos/declarative/twitter/content/AuthView.qml +++ b/demos/declarative/twitter/TwitterCore/AuthView.qml diff --git a/demos/declarative/twitter/content/Button.qml b/demos/declarative/twitter/TwitterCore/Button.qml index 4cba8c3..4cba8c3 100644 --- a/demos/declarative/twitter/content/Button.qml +++ b/demos/declarative/twitter/TwitterCore/Button.qml diff --git a/demos/declarative/twitter/content/FatDelegate.qml b/demos/declarative/twitter/TwitterCore/FatDelegate.qml index 2b9288b..0f013e6 100644 --- a/demos/declarative/twitter/content/FatDelegate.qml +++ b/demos/declarative/twitter/TwitterCore/FatDelegate.qml @@ -37,7 +37,7 @@ Component { + '<a href="app://@'+userScreenName+'"><b>'+userScreenName + "</b></a> from " +source + "<br /><b>" + addTags(statusText) + "</b></html>"; textFormat: Qt.RichText - color: "white"; color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true + color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true anchors.left: whiteRect.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6 onLinkActivated: handleLink(link) } diff --git a/demos/declarative/twitter/content/HomeTitleBar.qml b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml index a206c87..a206c87 100644 --- a/demos/declarative/twitter/content/HomeTitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml diff --git a/demos/declarative/twitter/content/Loading.qml b/demos/declarative/twitter/TwitterCore/Loading.qml index 3151415..76bf64b 100644 --- a/demos/declarative/twitter/content/Loading.qml +++ b/demos/declarative/twitter/TwitterCore/Loading.qml @@ -2,7 +2,7 @@ import Qt 4.6 Image { id: loading; source: "images/loading.png"; transformOrigin: "Center" - rotation: NumberAnimation { + NumberAnimation on rotation { from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900 } } diff --git a/demos/declarative/twitter/content/MultiTitleBar.qml b/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml index e0205b8..e0205b8 100644 --- a/demos/declarative/twitter/content/MultiTitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml diff --git a/demos/declarative/twitter/content/RssModel.qml b/demos/declarative/twitter/TwitterCore/RssModel.qml index 9d88bb7..9d88bb7 100644 --- a/demos/declarative/twitter/content/RssModel.qml +++ b/demos/declarative/twitter/TwitterCore/RssModel.qml diff --git a/demos/declarative/twitter/content/TitleBar.qml b/demos/declarative/twitter/TwitterCore/TitleBar.qml index 149aa82..149aa82 100644 --- a/demos/declarative/twitter/content/TitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/TitleBar.qml diff --git a/demos/declarative/twitter/content/ToolBar.qml b/demos/declarative/twitter/TwitterCore/ToolBar.qml index f96c767..f96c767 100644 --- a/demos/declarative/twitter/content/ToolBar.qml +++ b/demos/declarative/twitter/TwitterCore/ToolBar.qml diff --git a/demos/declarative/twitter/content/UserModel.qml b/demos/declarative/twitter/TwitterCore/UserModel.qml index c146b84..c146b84 100644 --- a/demos/declarative/twitter/content/UserModel.qml +++ b/demos/declarative/twitter/TwitterCore/UserModel.qml diff --git a/demos/declarative/twitter/content/images/gloss.png b/demos/declarative/twitter/TwitterCore/images/gloss.png Binary files differindex 5d370cd..5d370cd 100644 --- a/demos/declarative/twitter/content/images/gloss.png +++ b/demos/declarative/twitter/TwitterCore/images/gloss.png diff --git a/demos/declarative/twitter/content/images/lineedit.png b/demos/declarative/twitter/TwitterCore/images/lineedit.png Binary files differindex 2cc38dc..2cc38dc 100644 --- a/demos/declarative/twitter/content/images/lineedit.png +++ b/demos/declarative/twitter/TwitterCore/images/lineedit.png diff --git a/demos/declarative/twitter/content/images/lineedit.sci b/demos/declarative/twitter/TwitterCore/images/lineedit.sci index 054bff7..054bff7 100644 --- a/demos/declarative/twitter/content/images/lineedit.sci +++ b/demos/declarative/twitter/TwitterCore/images/lineedit.sci diff --git a/demos/declarative/twitter/content/images/loading.png b/demos/declarative/twitter/TwitterCore/images/loading.png Binary files differindex 47a1589..47a1589 100644 --- a/demos/declarative/twitter/content/images/loading.png +++ b/demos/declarative/twitter/TwitterCore/images/loading.png diff --git a/demos/declarative/twitter/content/images/stripes.png b/demos/declarative/twitter/TwitterCore/images/stripes.png Binary files differindex 9f36727..9f36727 100644 --- a/demos/declarative/twitter/content/images/stripes.png +++ b/demos/declarative/twitter/TwitterCore/images/stripes.png diff --git a/demos/declarative/twitter/content/images/titlebar.png b/demos/declarative/twitter/TwitterCore/images/titlebar.png Binary files differindex 51c9008..51c9008 100644 --- a/demos/declarative/twitter/content/images/titlebar.png +++ b/demos/declarative/twitter/TwitterCore/images/titlebar.png diff --git a/demos/declarative/twitter/content/images/titlebar.sci b/demos/declarative/twitter/TwitterCore/images/titlebar.sci index 0418d94..0418d94 100644 --- a/demos/declarative/twitter/content/images/titlebar.sci +++ b/demos/declarative/twitter/TwitterCore/images/titlebar.sci diff --git a/demos/declarative/twitter/content/images/toolbutton.png b/demos/declarative/twitter/TwitterCore/images/toolbutton.png Binary files differindex 1131001..1131001 100644 --- a/demos/declarative/twitter/content/images/toolbutton.png +++ b/demos/declarative/twitter/TwitterCore/images/toolbutton.png diff --git a/demos/declarative/twitter/content/images/toolbutton.sci b/demos/declarative/twitter/TwitterCore/images/toolbutton.sci index 9e4f965..9e4f965 100644 --- a/demos/declarative/twitter/content/images/toolbutton.sci +++ b/demos/declarative/twitter/TwitterCore/images/toolbutton.sci diff --git a/demos/declarative/twitter/TwitterCore/qmldir b/demos/declarative/twitter/TwitterCore/qmldir new file mode 100644 index 0000000..8b56c56 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/qmldir @@ -0,0 +1,10 @@ +AuthView 1.0 AuthView.qml +Button 1.0 Button.qml +FatDelegate 1.0 FatDelegate.qml +HomeTitleBar 1.0 HomeTitleBar.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 index b091b03..259f79a 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -1,5 +1,5 @@ import Qt 4.6 -import "content" as Twitter +import TwitterCore 1.0 as Twitter Item { id: screen; width: 320; height: 480 @@ -28,14 +28,14 @@ Item { id: background anchors.fill: parent; color: "#343434"; - Image { source: "content/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } + Image { source: "TwitterCore/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } 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: "white"; color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true + color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true visible: rssModel.status==XmlListModel.Error; anchors.centerIn: parent } diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml index 76a5813..30a5d78 100644 --- a/demos/declarative/webbrowser/content/FlickableWebView.qml +++ b/demos/declarative/webbrowser/content/FlickableWebView.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 Flickable { property alias title: webView.title @@ -22,6 +23,7 @@ Flickable { WebView { id: webView pixelCacheSize: 4000000 + transformOrigin: Item.TopLeft Script { function fixUrl(url) diff --git a/demos/declarative/webbrowser/content/fieldtext/FieldText.qml b/demos/declarative/webbrowser/content/fieldtext/FieldText.qml index 19b6acc..d282209 100644 --- a/demos/declarative/webbrowser/content/fieldtext/FieldText.qml +++ b/demos/declarative/webbrowser/content/fieldtext/FieldText.qml @@ -85,7 +85,7 @@ Item { font.bold: true text: label opacity: textEdit.text == '' ? 1 : 0 - opacity: Behavior { + Behavior on opacity { NumberAnimation { property: "opacity" duration: 250 diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index 6a427f4..b6cccb0 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import org.webkit 1.0 import "content" diff --git a/demos/demos.pro b/demos/demos.pro index 91b4ed1..013d40f 100644 --- a/demos/demos.pro +++ b/demos/demos.pro @@ -56,6 +56,7 @@ wince*:SUBDIRS += demos_sqlbrowser contains(QT_CONFIG, phonon):!static:SUBDIRS += demos_mediaplayer contains(QT_CONFIG, webkit):contains(QT_CONFIG, svg):!symbian:SUBDIRS += demos_browser contains(QT_CONFIG, multimedia):SUBDIRS += demos_multimedia +contains(QT_CONFIG, declarative):SUBDIRS += demos_declarative # install sources.files = README *.pro @@ -87,6 +88,7 @@ demos_undo.subdir = undo demos_qtdemo.subdir = qtdemo demos_mediaplayer.subdir = qmediaplayer demos_multimedia.subdir = multimedia +demos_declarative.subdir = declarative demos_browser.subdir = browser diff --git a/demos/interview/model.cpp b/demos/interview/model.cpp index 3f9548a..840bc60 100644 --- a/demos/interview/model.cpp +++ b/demos/interview/model.cpp @@ -45,6 +45,7 @@ Model::Model(int rows, int columns, QObject *parent) : QAbstractItemModel(parent), + services(QPixmap(":/images/services.png")), rc(rows), cc(columns), tree(new QVector<Node>(rows, Node(0))) { @@ -105,7 +106,6 @@ QVariant Model::data(const QModelIndex &index, int role) const QVariant Model::headerData(int section, Qt::Orientation orientation, int role) const { - static QIcon services(QPixmap(":/images/services.png")); if (role == Qt::DisplayRole) return QString::number(section); if (role == Qt::DecorationRole) diff --git a/demos/interview/model.h b/demos/interview/model.h index bad83a8..c7c15f7 100644 --- a/demos/interview/model.h +++ b/demos/interview/model.h @@ -44,6 +44,7 @@ #include <QAbstractItemModel> #include <QFileIconProvider> +#include <QIcon> #include <QVector> class Model : public QAbstractItemModel @@ -80,6 +81,7 @@ private: Node *parent(Node *child) const; int row(Node *node) const; + QIcon services; int rc, cc; QVector<Node> *tree; QFileIconProvider iconProvider; diff --git a/demos/mainwindow/mainwindow.cpp b/demos/mainwindow/mainwindow.cpp index 32066d7..3ddb74b 100644 --- a/demos/mainwindow/mainwindow.cpp +++ b/demos/mainwindow/mainwindow.cpp @@ -329,7 +329,7 @@ void MainWindow::setupDockWidgets(const QMap<QString, QSize> &customSizeHints) BlueTitleBar *titlebar = new BlueTitleBar(swatch); swatch->setTitleBarWidget(titlebar); connect(swatch, SIGNAL(topLevelChanged(bool)), titlebar, SLOT(updateMask())); - connect(swatch, SIGNAL(featuresChanged(QDockWidget::DockWidgetFeatures)), titlebar, SLOT(updateMask())); + connect(swatch, SIGNAL(featuresChanged(QDockWidget::DockWidgetFeatures)), titlebar, SLOT(updateMask()), Qt::QueuedConnection); #ifdef Q_WS_QWS QPalette pal = palette(); diff --git a/demos/multimedia/player/player.cpp b/demos/multimedia/player/player.cpp index 49d18cb..af30a97 100644 --- a/demos/multimedia/player/player.cpp +++ b/demos/multimedia/player/player.cpp @@ -81,6 +81,22 @@ Player::Player(QWidget *parent) connect(playlistView, SIGNAL(activated(QModelIndex)), this, SLOT(jump(QModelIndex))); + playbackModeBox = new QComboBox; + playbackModeBox->addItem(tr("Linear"), + QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::Linear)); + playbackModeBox->addItem(tr("Loop"), + QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::Loop)); + playbackModeBox->addItem(tr("Random"), + QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::Random)); + playbackModeBox->addItem(tr("Current Item Once"), + QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::CurrentItemOnce)); + playbackModeBox->addItem(tr("Current Item In Loop"), + QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::CurrentItemInLoop)); + playbackModeBox->setCurrentIndex(0); + + connect(playbackModeBox, SIGNAL(activated(int)), SLOT(updatePlaybackMode())); + updatePlaybackMode(); + slider = new QSlider(Qt::Horizontal); slider->setRange(0, player->duration() / 1000); @@ -126,12 +142,16 @@ Player::Player(QWidget *parent) else colorButton->setEnabled(false); + QBoxLayout *playlistLayout = new QVBoxLayout; + playlistLayout->addWidget(playlistView); + playlistLayout->addWidget(playbackModeBox); + QBoxLayout *displayLayout = new QHBoxLayout; if (videoWidget) displayLayout->addWidget(videoWidget, 2); else displayLayout->addWidget(coverLabel, 2); - displayLayout->addWidget(playlistView); + displayLayout->addLayout(playlistLayout); QBoxLayout *controlLayout = new QHBoxLayout; controlLayout->setMargin(0); @@ -333,3 +353,9 @@ void Player::showColorDialog() } colorDialog->show(); } + +void Player::updatePlaybackMode() +{ + playlist->setPlaybackMode( + playbackModeBox->itemData(playbackModeBox->currentIndex()).value<QMediaPlaylist::PlaybackMode>()); +} diff --git a/demos/multimedia/player/player.h b/demos/multimedia/player/player.h index 1de8b1a..cda3eb9 100644 --- a/demos/multimedia/player/player.h +++ b/demos/multimedia/player/player.h @@ -57,6 +57,7 @@ class QAbstractItemView; class QLabel; class QModelIndex; class QSlider; +class QComboBox; class QMediaPlayer; class QVideoWidget; class PlaylistModel; @@ -87,6 +88,7 @@ private slots: void bufferingProgress(int progress); void showColorDialog(); + void updatePlaybackMode(); private: void setTrackInfo(const QString &info); @@ -97,6 +99,7 @@ private: QVideoWidget *videoWidget; QLabel *coverLabel; QSlider *slider; + QComboBox *playbackModeBox; PlaylistModel *playlistModel; QAbstractItemView *playlistView; QDialog *colorDialog; diff --git a/demos/qtdemo/qtdemo.pro b/demos/qtdemo/qtdemo.pro index 011ea0c..2a776ac 100644 --- a/demos/qtdemo/qtdemo.pro +++ b/demos/qtdemo/qtdemo.pro @@ -3,8 +3,6 @@ TARGET = qtdemo DEMO_DESTDIR = $$QT_BUILD_TREE isEmpty(DEMO_DESTDIR):DEMO_DESTDIR=../.. DESTDIR = $$DEMO_DESTDIR/bin -OBJECTS_DIR = .obj -MOC_DIR = .moc INSTALLS += target sources diff --git a/demos/spreadsheet/spreadsheet.cpp b/demos/spreadsheet/spreadsheet.cpp index 9693f3c..f2a1738 100644 --- a/demos/spreadsheet/spreadsheet.cpp +++ b/demos/spreadsheet/spreadsheet.cpp @@ -70,6 +70,7 @@ SpreadSheet::SpreadSheet(int rows, int cols, QWidget *parent) updateColor(0); setupMenuBar(); setupContents(); + setupContextMenu(); setCentralWidget(table); statusBar(); diff --git a/demos/sqlbrowser/browser.cpp b/demos/sqlbrowser/browser.cpp index 6aed73a..1232428 100644 --- a/demos/sqlbrowser/browser.cpp +++ b/demos/sqlbrowser/browser.cpp @@ -146,7 +146,7 @@ void Browser::showTable(const QString &t) { QSqlTableModel *model = new QSqlTableModel(table, connectionWidget->currentDatabase()); model->setEditStrategy(QSqlTableModel::OnRowChange); - model->setTable(t); + model->setTable(connectionWidget->currentDatabase().driver()->escapeIdentifier(t, QSqlDriver::TableName)); model->select(); if (model->lastError().type() != QSqlError::NoError) emit statusMessage(model->lastError().text()); |