summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-07-12 12:35:27 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-07-12 12:35:27 (GMT)
commit55ff179342bfb67b6f2592d7b1df66e1f3c6a350 (patch)
tree266b6e82ae4de9c1eb2f0c2d2c2310f774a55089 /demos
parent0713442baa4120050e85c13998797415bb40efce (diff)
parente4f5a81869e75a998278c19134f2772fefd998fe (diff)
downloadQt-55ff179342bfb67b6f2592d7b1df66e1f3c6a350.zip
Qt-55ff179342bfb67b6f2592d7b1df66e1f3c6a350.tar.gz
Qt-55ff179342bfb67b6f2592d7b1df66e1f3c6a350.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'demos')
-rw-r--r--demos/.gitignore2
-rw-r--r--demos/declarative/calculator/Core/calculator.js2
-rw-r--r--demos/declarative/calculator/calculator.qml29
-rw-r--r--demos/declarative/minehunt/minehunt.pro2
-rw-r--r--demos/declarative/rssnews/content/NewsDelegate.qml3
-rw-r--r--demos/declarative/samegame/SamegameCore/BoomBlock.qml11
-rw-r--r--demos/declarative/samegame/SamegameCore/Dialog.qml2
-rwxr-xr-xdemos/declarative/samegame/SamegameCore/samegame.js7
-rw-r--r--demos/declarative/samegame/samegame.qml2
-rw-r--r--demos/declarative/snake/content/snake.js6
-rw-r--r--demos/declarative/twitter/TwitterCore/AuthView.qml1
-rw-r--r--demos/declarative/twitter/TwitterCore/HomeTitleBar.qml2
-rw-r--r--demos/embedded/anomaly/src/BookmarksView.cpp2
-rw-r--r--demos/embedded/anomaly/src/BrowserView.cpp1
-rw-r--r--demos/qtdemo/examplecontent.cpp15
-rw-r--r--demos/qtdemo/menumanager.cpp6
-rw-r--r--demos/qtdemo/qmlShell.qml4
-rw-r--r--demos/spectrum/3rdparty/fftreal/fftreal.pro14
-rw-r--r--demos/spectrum/app/.gitignore2
-rw-r--r--demos/spectrum/app/app.pro22
-rw-r--r--demos/spectrum/app/spectrum.sh50
21 files changed, 80 insertions, 105 deletions
diff --git a/demos/.gitignore b/demos/.gitignore
new file mode 100644
index 0000000..bc54bd5
--- /dev/null
+++ b/demos/.gitignore
@@ -0,0 +1,2 @@
+*.dll
+*.dso
diff --git a/demos/declarative/calculator/Core/calculator.js b/demos/declarative/calculator/Core/calculator.js
index 51b3dd3..c80c42f 100644
--- a/demos/declarative/calculator/Core/calculator.js
+++ b/demos/declarative/calculator/Core/calculator.js
@@ -84,7 +84,7 @@ function doOperation(op) {
}
if (op == rotateLeft)
- main.state = 'rotated'
+ main.state = "orientation " + Orientation.Landscape
if (op == rotateRight)
main.state = ''
}
diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml
index 3d36211..63b6c55 100644
--- a/demos/declarative/calculator/calculator.qml
+++ b/demos/declarative/calculator/calculator.qml
@@ -58,10 +58,11 @@ Rectangle {
property string plusminus : "\u00b1"
function doOp(operation) { CalcEngine.doOperation(operation) }
-
+
Item {
id: main
- state: (runtime.orientation == Orientation.Portrait) ? '' : 'rotated'
+ state: "orientation " + runtime.orientation
+
width: parent.width; height: parent.height; anchors.centerIn: parent
Column {
@@ -130,16 +131,28 @@ Rectangle {
}
}
- states: State {
- name: 'rotated'
- PropertyChanges { target: main; rotation: -90; width: window.height; height: window.width }
- PropertyChanges { target: rotateButton; operation: rotateRight }
- }
+ states: [
+ State {
+ name: "orientation " + Orientation.Landscape
+ PropertyChanges { target: main; rotation: -90; width: window.height; height: window.width }
+ PropertyChanges { target: rotateButton; operation: rotateRight }
+ },
+ State {
+ name: "orientation " + Orientation.PortraitInverted
+ PropertyChanges { target: main; rotation: -180; }
+ PropertyChanges { target: rotateButton; operation: rotateLeft }
+ },
+ State {
+ name: "orientation " + Orientation.LandscapeInverted
+ PropertyChanges { target: main; rotation: -270; width: window.height; height: window.width }
+ PropertyChanges { target: rotateButton; operation: rotateRight }
+ }
+ ]
transitions: Transition {
SequentialAnimation {
PropertyAction { target: rotateButton; property: "operation" }
- NumberAnimation { properties: "rotation"; duration: 300; easing.type: Easing.InOutQuint }
+ 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/minehunt/minehunt.pro b/demos/declarative/minehunt/minehunt.pro
index aac91f6..f85afeb 100644
--- a/demos/declarative/minehunt/minehunt.pro
+++ b/demos/declarative/minehunt/minehunt.pro
@@ -27,7 +27,7 @@ symbian:{
TARGET.EPOCALLOWDLLDATA = 1
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
TARGET.CAPABILITY = NetworkServices ReadUserData
- importFiles.sources = qmlminehuntplugin.dll \
+ importFiles.sources = MinehuntCore/qmlminehuntplugin.dll \
MinehuntCore/Explosion.qml \
MinehuntCore/pics \
MinehuntCore/qmldir
diff --git a/demos/declarative/rssnews/content/NewsDelegate.qml b/demos/declarative/rssnews/content/NewsDelegate.qml
index 040dadc..cfe9b00 100644
--- a/demos/declarative/rssnews/content/NewsDelegate.qml
+++ b/demos/declarative/rssnews/content/NewsDelegate.qml
@@ -43,10 +43,11 @@ import Qt 4.7
Item {
id: delegate
- height: childrenRect.height + 20
+ height: column.height + 40
width: delegate.ListView.view.width
Column {
+ id: column
x: 20; y: 20
width: parent.width - 40
diff --git a/demos/declarative/samegame/SamegameCore/BoomBlock.qml b/demos/declarative/samegame/SamegameCore/BoomBlock.qml
index 3f43579..43050af 100644
--- a/demos/declarative/samegame/SamegameCore/BoomBlock.qml
+++ b/demos/declarative/samegame/SamegameCore/BoomBlock.qml
@@ -47,11 +47,14 @@ Item {
property bool dying: false
property bool spawned: false
property int type: 0
- property int targetX: 0
- property int targetY: 0
- SpringFollow on x { enabled: spawned; to: targetX; spring: 2; damping: 0.2 }
- SpringFollow on y { to: targetY; spring: 2; damping: 0.2 }
+ Behavior on x {
+ enabled: spawned;
+ SpringAnimation{ spring: 2; damping: 0.2 }
+ }
+ Behavior on y {
+ SpringAnimation{ spring: 2; damping: 0.2 }
+ }
Image {
id: img
diff --git a/demos/declarative/samegame/SamegameCore/Dialog.qml b/demos/declarative/samegame/SamegameCore/Dialog.qml
index c71a4b3..7e64bd6 100644
--- a/demos/declarative/samegame/SamegameCore/Dialog.qml
+++ b/demos/declarative/samegame/SamegameCore/Dialog.qml
@@ -49,6 +49,8 @@ Rectangle {
signal closed
signal opened
function forceClose() {
+ if(page.opacity == 0)
+ return; //already closed
page.closed();
page.opacity = 0;
}
diff --git a/demos/declarative/samegame/SamegameCore/samegame.js b/demos/declarative/samegame/SamegameCore/samegame.js
index 5c008a2..6e1b24d 100755
--- a/demos/declarative/samegame/SamegameCore/samegame.js
+++ b/demos/declarative/samegame/SamegameCore/samegame.js
@@ -110,7 +110,7 @@ function shuffleDown()
}else{
if(fallDist > 0){
var obj = board[index(column,row)];
- obj.targetY += fallDist * gameCanvas.blockSize;
+ obj.y += fallDist * gameCanvas.blockSize;
board[index(column,row+fallDist)] = obj;
board[index(column,row)] = null;
}
@@ -128,7 +128,7 @@ function shuffleDown()
obj = board[index(column,row)];
if(obj == null)
continue;
- obj.targetX -= fallDist * gameCanvas.blockSize;
+ obj.x -= fallDist * gameCanvas.blockSize;
board[index(column-fallDist,row)] = obj;
board[index(column,row)] = null;
}
@@ -184,8 +184,7 @@ function createBlock(column,row){
}
dynamicObject.type = Math.floor(Math.random() * 3);
dynamicObject.x = column*gameCanvas.blockSize;
- dynamicObject.targetX = column*gameCanvas.blockSize;
- dynamicObject.targetY = row*gameCanvas.blockSize;
+ dynamicObject.y = row*gameCanvas.blockSize;
dynamicObject.width = gameCanvas.blockSize;
dynamicObject.height = gameCanvas.blockSize;
dynamicObject.spawned = true;
diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml
index 10bf79f..9504fb6 100644
--- a/demos/declarative/samegame/samegame.qml
+++ b/demos/declarative/samegame/samegame.qml
@@ -88,7 +88,7 @@ Rectangle {
Behavior on width {
NumberAnimation {}
- enabled: initialWidth != 0
+ enabled: nameInputDialog.initialWidth != 0
}
onOpened: nameInputText.focus = true;
diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js
index 4d05e33..0f0dbf7 100644
--- a/demos/declarative/snake/content/snake.js
+++ b/demos/declarative/snake/content/snake.js
@@ -150,7 +150,7 @@ function move() {
snake.push(newLink);
} else {
var lastLink = snake[snake.length-1];
- board[lastLink.row * numColumns + lastLink.column] = Undefined;
+ board[lastLink.row * numColumns + lastLink.column] = undefined;
}
if (waitForCookie > 0) {
@@ -186,7 +186,7 @@ function move() {
function isFree(row, column)
{
- return board[row * numColumns + column] == Undefined;
+ return board[row * numColumns + column] == undefined;
}
function isHead(row, column)
@@ -214,7 +214,7 @@ function moveSkull()
--linksToDie;
var link = snake.pop();
link.dying = true;
- board[link.row * numColumns + link.column] = Undefined;
+ board[link.row * numColumns + link.column] = undefined;
if (score > 0)
--score;
if (snake.length == 0) {
diff --git a/demos/declarative/twitter/TwitterCore/AuthView.qml b/demos/declarative/twitter/TwitterCore/AuthView.qml
index ef10258..4f75777 100644
--- a/demos/declarative/twitter/TwitterCore/AuthView.qml
+++ b/demos/declarative/twitter/TwitterCore/AuthView.qml
@@ -93,6 +93,7 @@ Item {
color: "#151515"; selectionColor: "green"
KeyNavigation.tab: login
KeyNavigation.backtab: nameIn
+ onAccepted: login.doLogin();
}
}
}
diff --git a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml
index 52164ed..b26f7b3 100644
--- a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml
+++ b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml
@@ -128,7 +128,7 @@ Item {
cursorVisible: true; font.bold: true
width: parent.width - 12
height: parent.height - 8
- font.pointSize: 10
+ font.pixelSize: 12
wrapMode: TextEdit.Wrap
color: "#151515"; selectionColor: "green"
}
diff --git a/demos/embedded/anomaly/src/BookmarksView.cpp b/demos/embedded/anomaly/src/BookmarksView.cpp
index 729bf73..d6e6035 100644
--- a/demos/embedded/anomaly/src/BookmarksView.cpp
+++ b/demos/embedded/anomaly/src/BookmarksView.cpp
@@ -55,7 +55,7 @@ BookmarksView::BookmarksView(QWidget *parent)
m_iconView->addItem("www.google.com");
m_iconView->addItem("qt.nokia.com/doc/4.5");
- m_iconView->addItem("news.bbc.co.uk/text_only.stm");
+ m_iconView->addItem("news.bbc.co.uk/2/mobile/default.stm");
m_iconView->addItem("mobile.wikipedia.org");
m_iconView->addItem("qt.nokia.com");
m_iconView->addItem("en.wikipedia.org");
diff --git a/demos/embedded/anomaly/src/BrowserView.cpp b/demos/embedded/anomaly/src/BrowserView.cpp
index 41318ad..a6e6f7a 100644
--- a/demos/embedded/anomaly/src/BrowserView.cpp
+++ b/demos/embedded/anomaly/src/BrowserView.cpp
@@ -177,7 +177,6 @@ void BrowserView::resizeEvent(QResizeEvent *event)
void BrowserView::setDefaultIap()
{
qt_SetDefaultIap();
- m_webView->load(QUrl("http://news.bbc.co.uk/text_only.stm"));
}
#endif
diff --git a/demos/qtdemo/examplecontent.cpp b/demos/qtdemo/examplecontent.cpp
index b93062c..19be3e0 100644
--- a/demos/qtdemo/examplecontent.cpp
+++ b/demos/qtdemo/examplecontent.cpp
@@ -79,14 +79,20 @@ void ExampleContent::animationStopped(int id)
QString ExampleContent::loadDescription()
{
QByteArray ba = MenuManager::instance()->getHtml(this->name);
+ QString errorMsg;
+ int errorLine, errorColumn;
QDomDocument exampleDoc;
- exampleDoc.setContent(ba, false);
+ if (!exampleDoc.setContent(ba, false, &errorMsg, &errorLine, &errorColumn)) {
+ qDebug() << errorMsg << errorLine << errorColumn;
+ }
QDomNodeList paragraphs = exampleDoc.elementsByTagName("p");
if (paragraphs.length() < 1 && Colors::verbose)
- qDebug() << "- ExampleContent::loadDescription(): Could not load description:" << MenuManager::instance()->info[this->name]["docfile"];
- QString description = Colors::contentColor + QLatin1String("Could not load description. Ensure that the documentation for Qt is built.");
+ qDebug() << "- ExampleContent::loadDescription(): Could not load description:"
+ << MenuManager::instance()->info[this->name]["docfile"];
+ QString description = Colors::contentColor +
+ QLatin1String("Could not load description. Ensure that the documentation for Qt is built.");
for (int p = 0; p < int(paragraphs.length()); ++p) {
description = this->extractTextFromParagraph(paragraphs.item(p));
if (this->isSummary(description)) {
@@ -99,7 +105,8 @@ QString ExampleContent::loadDescription()
bool ExampleContent::isSummary(const QString &text)
{
return (!text.contains("[") &&
- text.indexOf(QRegExp(QString("(In )?((The|This) )?(%1 )?.*(tutorial|example|demo|application)").arg(this->name), Qt::CaseInsensitive)) != -1);
+ text.indexOf(QRegExp(QString("(In )?((The|This) )?(%1 )?.*(tutorial|example|demo|application)").arg(this->name),
+ Qt::CaseInsensitive)) != -1);
}
QString ExampleContent::extractTextFromParagraph(const QDomNode &parentNode)
diff --git a/demos/qtdemo/menumanager.cpp b/demos/qtdemo/menumanager.cpp
index a2ceb0e..15561ab 100644
--- a/demos/qtdemo/menumanager.cpp
+++ b/demos/qtdemo/menumanager.cpp
@@ -369,10 +369,10 @@ void MenuManager::launchQmlExample(const QString &name)
dir = QDir(QLibraryInfo::location(QLibraryInfo::DemosPath));
else
dir = QDir(QLibraryInfo::location(QLibraryInfo::ExamplesPath));
- QFile file(dir.path() + "/" + dirName + "/" + fileName + "/" + fileName.split('/').last() + ".qml");
+ QFile file(dir.path() + "/" + dirName + "/" + fileName + "/" + "main.qml");
if(!file.exists()){
- //try main.qml as well
- file.setFileName(dir.path() + "/" + dirName + "/" + fileName + "/" + "main.qml");
+ //try dirname.qml as well
+ file.setFileName(dir.path() + "/" + dirName + "/" + fileName + "/" + fileName.split('/').last() + ".qml");
if(!file.exists()){
exampleError(QProcess::UnknownError);
return;
diff --git a/demos/qtdemo/qmlShell.qml b/demos/qtdemo/qmlShell.qml
index 5c5f96c..e15d33c 100644
--- a/demos/qtdemo/qmlShell.qml
+++ b/demos/qtdemo/qmlShell.qml
@@ -99,6 +99,7 @@ Item {
}
MouseArea{
anchors.fill: parent
+ acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onClicked: loader.focus=true;/* and don't propogate to the 'exit' area*/
}
@@ -130,7 +131,7 @@ Item {
textFormat: Text.RichText
//Note that if loader is Error, it is because the file was found but there was an error creating the component
//This means either we have a bug in our demos, or the required modules (which ship with Qt) did not deploy correctly
- text: "The example has failed to load.<br />If you installed Qt's QML modules this is a bug!<br />"
+ text: "The example has failed to load.<br />If you installed all Qt's C++ and QML modules then this is a bug!<br />"
+ 'Report it at <a href="http://bugreports.qt.nokia.com">http://bugreports.qt.nokia.com</a>';
onLinkActivated: Qt.openUrlExternally(link);
}
@@ -145,6 +146,7 @@ Item {
z: 8
enabled: main.show
hoverEnabled: main.show //To steal focus from the buttons
+ acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
anchors.fill: parent
onClicked: main.show=false;
}
diff --git a/demos/spectrum/3rdparty/fftreal/fftreal.pro b/demos/spectrum/3rdparty/fftreal/fftreal.pro
index 6801b42..c9da205 100644
--- a/demos/spectrum/3rdparty/fftreal/fftreal.pro
+++ b/demos/spectrum/3rdparty/fftreal/fftreal.pro
@@ -1,3 +1,5 @@
+include(../../spectrum.pri)
+
TEMPLATE = lib
TARGET = fftreal
@@ -31,13 +33,13 @@ symbian {
# Provide unique ID for the generated binary, required by Symbian OS
TARGET.UID3 = 0xA000E403
TARGET.CAPABILITY = UserEnvironment
+}
+
+macx {
+ CONFIG += lib_bundle
} else {
- macx {
- CONFIG += lib_bundle
- } else {
- DESTDIR = ../../bin
- }
-}
+ !symbian: DESTDIR = ../..
+}
# Install
diff --git a/demos/spectrum/app/.gitignore b/demos/spectrum/app/.gitignore
new file mode 100644
index 0000000..82cf2a2
--- /dev/null
+++ b/demos/spectrum/app/.gitignore
@@ -0,0 +1,2 @@
+spectrum
+spectrum.exe
diff --git a/demos/spectrum/app/app.pro b/demos/spectrum/app/app.pro
index c15edf9..1b419db 100644
--- a/demos/spectrum/app/app.pro
+++ b/demos/spectrum/app/app.pro
@@ -3,7 +3,6 @@ include(../spectrum.pri)
TEMPLATE = app
TARGET = spectrum
-unix: !macx: !symbian: TARGET = spectrum.bin
QT += multimedia
@@ -64,8 +63,7 @@ symbian {
LIBS += -F$${fftreal_dir}
LIBS += -framework fftreal
} else {
- # Link to dynamic library which is written to ../bin
- LIBS += -L../bin
+ LIBS += -L..
LIBS += -lfftreal
}
}
@@ -86,7 +84,7 @@ symbian {
!contains(DEFINES, DISABLE_FFT) {
# Include FFTReal DLL in the SIS file
- fftreal.sources = $${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/fftreal.dll
+ fftreal.sources = ../fftreal.dll
fftreal.path = !:/sys/bin
DEPLOYMENT += fftreal
}
@@ -111,17 +109,11 @@ symbian {
}
} else {
# Specify directory in which to create spectrum application
- DESTDIR = ../bin
-
- unix: !symbian {
- # On unices other than Mac OSX, we copy a shell script into the bin directory.
- # This script takes care of correctly setting the LD_LIBRARY_PATH so that
- # the dynamic library can be located.
- copy_launch_script.target = copy_launch_script
- copy_launch_script.commands = \
- install -m 0555 $$QT_SOURCE_TREE/demos/spectrum/app/spectrum.sh ../bin/spectrum
- QMAKE_EXTRA_TARGETS += copy_launch_script
- POST_TARGETDEPS += copy_launch_script
+ DESTDIR = ..
+
+ unix: {
+ # Provide relative path from application to fftreal library
+ QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN
}
}
}
diff --git a/demos/spectrum/app/spectrum.sh b/demos/spectrum/app/spectrum.sh
deleted file mode 100644
index 2a230ed..0000000
--- a/demos/spectrum/app/spectrum.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/sh
-#############################################################################
-##
-## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-## All rights reserved.
-## Contact: Nokia Corporation (qt-info@nokia.com)
-##
-## This file is part of the examples 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$
-##
-#############################################################################
-
-
-# Shell script for launching spectrum application on Unix systems other than Mac OSX
-
-bindir=`dirname "$0"`
-LD_LIBRARY_PATH="${bindir}:${LD_LIBRARY_PATH}"
-export LD_LIBRARY_PATH
-exec "${bindir}/spectrum.bin" ${1+"$@"}
-