summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2010-05-26 11:28:42 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2010-05-26 11:28:42 (GMT)
commitf2d6af86383cfd9d5344673f4c755f06b900fa46 (patch)
treea00711f73c644f59523899627d309fd8665ca07c /demos
parent70ae881499ec329e6fdf96d56a6189f77641b3b0 (diff)
parent39b861b75566c4db0db3b5aba2aa191a59f10bdb (diff)
downloadQt-f2d6af86383cfd9d5344673f4c755f06b900fa46.zip
Qt-f2d6af86383cfd9d5344673f4c755f06b900fa46.tar.gz
Qt-f2d6af86383cfd9d5344673f4c755f06b900fa46.tar.bz2
Merge branch '4.7' of scm.dev.troll.no:qt/qt into 4.7
Conflicts: src/gui/kernel/qapplication_s60.cpp
Diffstat (limited to 'demos')
-rw-r--r--demos/declarative/minehunt/MinehuntCore/qmldir2
-rw-r--r--demos/declarative/minehunt/minehunt.pro6
-rw-r--r--demos/declarative/twitter/TwitterCore/HomeTitleBar.qml2
-rw-r--r--demos/qtdemo/MagicAnim.qml60
-rw-r--r--demos/qtdemo/colors.cpp4
-rw-r--r--demos/qtdemo/colors.h1
-rw-r--r--demos/qtdemo/mainwindow.cpp23
-rw-r--r--demos/qtdemo/mainwindow.h3
-rw-r--r--demos/qtdemo/menumanager.cpp110
-rw-r--r--demos/qtdemo/menumanager.h9
-rw-r--r--demos/qtdemo/qmlShell.qml158
-rw-r--r--demos/qtdemo/qtdemo.pro5
-rw-r--r--demos/qtdemo/qtdemo.qrc18
-rw-r--r--demos/qtdemo/xml/examples.xml36
-rw-r--r--demos/spectrum/3rdparty/fftreal/fftreal.pro6
-rw-r--r--demos/spectrum/app/app.pro9
-rw-r--r--demos/spectrum/spectrum.pro18
17 files changed, 422 insertions, 48 deletions
diff --git a/demos/declarative/minehunt/MinehuntCore/qmldir b/demos/declarative/minehunt/MinehuntCore/qmldir
index 95bccc8..2beccf9 100644
--- a/demos/declarative/minehunt/MinehuntCore/qmldir
+++ b/demos/declarative/minehunt/MinehuntCore/qmldir
@@ -1,3 +1,3 @@
-plugin minehunt
+plugin qmlminehuntplugin
Explosion 1.0 Explosion.qml
Tile 1.0 Tile.qml
diff --git a/demos/declarative/minehunt/minehunt.pro b/demos/declarative/minehunt/minehunt.pro
index 41640f5..91d02cf 100644
--- a/demos/declarative/minehunt/minehunt.pro
+++ b/demos/declarative/minehunt/minehunt.pro
@@ -1,5 +1,5 @@
TEMPLATE = lib
-TARGET = minehunt
+TARGET = qmlminehuntplugin
QT += declarative
CONFIG += qt plugin
@@ -28,11 +28,11 @@ symbian:{
TARGET.EPOCALLOWDLLDATA = 1
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
TARGET.CAPABILITY = NetworkServices ReadUserData
- importFiles.sources = minehunt.dll \
+ importFiles.sources = qmlminehuntplugin.dll \
MinehuntCore/Explosion.qml \
MinehuntCore/pics \
MinehuntCore/qmldir
- importFiles.path = $$QT_IMPORTS_BASE_DIR/MinehuntCore
+ importFiles.path = MinehuntCore
DEPLOYMENT = importFiles
}
diff --git a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml
index 2eaa40c..3828a40 100644
--- a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml
+++ b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml
@@ -129,7 +129,7 @@ Item {
width: parent.width - 12
height: parent.height - 8
font.pointSize: 10
- wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ wrapMode: TextEdit.Wrap
color: "#151515"; selectionColor: "green"
}
Keys.forwardTo: [(returnKey), (editor)]
diff --git a/demos/qtdemo/MagicAnim.qml b/demos/qtdemo/MagicAnim.qml
new file mode 100644
index 0000000..7ac3e1c
--- /dev/null
+++ b/demos/qtdemo/MagicAnim.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** 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 demonstration applications 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 Qt 4.7
+
+//Emulates the in animation of the menu elements
+SequentialAnimation{
+ id: main;
+ property Item target
+ property int from: 0
+ property int to: 100
+ property int duration: 1000
+ property string properties: "y"
+ PauseAnimation { duration: main.duration*0.20 }
+ NumberAnimation { target: main.target; properties: main.properties; from: main.from; to: main.to + 40; duration: main.duration*0.30 }
+ NumberAnimation { target: main.target; properties: main.properties; from: main.to + 40; to: main.to; duration: main.duration*0.10 }
+ NumberAnimation { target: main.target; properties: main.properties; from: main.to; to: main.to + 20; duration: main.duration*0.10 }
+ NumberAnimation { target: main.target; properties: main.properties; from: main.to + 20; to: main.to; duration: main.duration*0.10 }
+ NumberAnimation { target: main.target; properties: main.properties; from: main.to; to: main.to + 8; duration: main.duration*0.10 }
+ NumberAnimation { target: main.target; properties: main.properties; from: main.to + 8; to: main.to; duration: main.duration*0.10 }
+}
+
diff --git a/demos/qtdemo/colors.cpp b/demos/qtdemo/colors.cpp
index 802d77d..07cf162 100644
--- a/demos/qtdemo/colors.cpp
+++ b/demos/qtdemo/colors.cpp
@@ -81,6 +81,7 @@ bool Colors::noRescale = false;
bool Colors::noAnimations = false;
bool Colors::noBlending = false;
bool Colors::noScreenSync = false;
+bool Colors::noBlur = true;
bool Colors::fullscreen = false;
bool Colors::usePixmaps = false;
bool Colors::useLoop = false;
@@ -232,6 +233,8 @@ void Colors::parseArgs(int argc, char *argv[])
Colors::showFps = true;
else if (s == "-no-blending")
Colors::noBlending = true;
+ else if (s == "-use-blur")
+ Colors::noBlur = false;
else if (s == "-no-sync")
Colors::noScreenSync = true;
else if (s.startsWith("-menu"))
@@ -295,6 +298,7 @@ void Colors::setLowSettings()
Colors::usePixmaps = true;
Colors::noAnimations = true;
Colors::noBlending = true;
+ Colors::noBlur = true;
}
void Colors::detectSystemResources()
diff --git a/demos/qtdemo/colors.h b/demos/qtdemo/colors.h
index 1e0b795..2d58058 100644
--- a/demos/qtdemo/colors.h
+++ b/demos/qtdemo/colors.h
@@ -91,6 +91,7 @@ public:
static bool noAnimations;
static bool noBlending;
static bool noScreenSync;
+ static bool noBlur;
static bool useLoop;
static bool noWindowMask;
static bool usePixmaps;
diff --git a/demos/qtdemo/mainwindow.cpp b/demos/qtdemo/mainwindow.cpp
index a679c4f..45ec9a6 100644
--- a/demos/qtdemo/mainwindow.cpp
+++ b/demos/qtdemo/mainwindow.cpp
@@ -270,8 +270,10 @@ void MainWindow::setupSceneItems()
this->fpsLabel->setPos(Colors::stageStartX, 600 - QFontMetricsF(Colors::buttonFont()).height() - 5);
}
- this->companyLogo = new ImageItem(QImage(":/images/trolltech-logo.png"), 1000, 1000, this->scene, 0, true, 0.5f);
- this->qtLogo = new ImageItem(QImage(":/images/qtlogo_small.png"), 1000, 1000, this->scene, 0, true, 0.5f);
+ this->mainSceneRoot = new QGraphicsWidget();
+ this->scene->addItem(mainSceneRoot);
+ this->companyLogo = new ImageItem(QImage(":/images/trolltech-logo.png"), 1000, 1000, this->scene, mainSceneRoot, true, 0.5f);
+ this->qtLogo = new ImageItem(QImage(":/images/qtlogo_small.png"), 1000, 1000, this->scene, mainSceneRoot, true, 0.5f);
this->companyLogo->setZValue(100);
this->qtLogo->setZValue(100);
this->pausedLabel = new DemoTextItem(QString("PAUSED"), Colors::buttonFont(), Qt::white, -1, this->scene, 0);
@@ -308,6 +310,20 @@ void MainWindow::checkAdapt()
qDebug() << "- benchmark adaption: removed ticker (fps < 30)";
}
+ //Note: Because we don't adapt later in the program, if blur makes FPS plummet then we won't catch it
+ if (!Colors::noBlur && MenuManager::instance()->mainSceneBlur && this->mainSceneRoot){
+ Colors::noBlur = true;
+ this->mainSceneRoot->setGraphicsEffect(0);
+ MenuManager::instance()->mainSceneBlur = 0;
+ if(MenuManager::instance()->qmlRoot){
+ MenuManager::instance()->qmlRoot->setGraphicsEffect(0);
+ MenuManager::instance()->declarativeEngine->rootContext()->setContextProperty("realBlur", 0);
+ }
+ MenuManager::instance()->qmlShadow = 0;
+ if (Colors::verbose)
+ qDebug() << "- benchmark adaption: removed blur (fps < 30)";
+ }
+
if (this->fpsMedian < 20){
Colors::noAnimations = true;
if (Colors::verbose)
@@ -376,7 +392,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
this->loop = false;
QApplication::quit();
}
- else if (event->key() == Qt::Key_1){
+ else if (event->key() == Qt::Key_F1){
QString s("");
s += "Rendering system: ";
if (Colors::openGlRendering)
@@ -415,6 +431,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
s += Colors::noScreenSync ? "no" : "yes";
QMessageBox::information(0, QString("Current configuration"), s);
}
+ QGraphicsView::keyPressEvent(event);
}
void MainWindow::focusInEvent(QFocusEvent *)
diff --git a/demos/qtdemo/mainwindow.h b/demos/qtdemo/mainwindow.h
index edcc146..e613268 100644
--- a/demos/qtdemo/mainwindow.h
+++ b/demos/qtdemo/mainwindow.h
@@ -43,6 +43,7 @@
#define MAIN_WINDOW_H
#include <QtGui>
+#include <QtDeclarative>
#include <QPixmap>
class DemoTextItem;
@@ -62,6 +63,8 @@ public:
void start();
QGraphicsScene *scene;
+ QGraphicsWidget* mainSceneRoot;
+
bool loop;
// FPS stuff:
diff --git a/demos/qtdemo/menumanager.cpp b/demos/qtdemo/menumanager.cpp
index 40af30f..9eb5664 100644
--- a/demos/qtdemo/menumanager.cpp
+++ b/demos/qtdemo/menumanager.cpp
@@ -59,6 +59,8 @@ MenuManager::MenuManager()
this->tickerInAnim = 0;
this->upButton = 0;
this->downButton = 0;
+ this->mainSceneBlur = 0;
+ this->qmlShadow = 0;
this->helpEngine = 0;
this->score = new Score();
this->currentMenu = QLatin1String("[no menu visible]");
@@ -152,6 +154,9 @@ void MenuManager::itemSelected(int userCode, const QString &menuName)
case LAUNCH:
this->launchExample(this->currentInfo);
break;
+ case LAUNCH_QML:
+ this->launchQmlExample(this->currentInfo);
+ break;
case DOCUMENTATION:
this->showDocInAssistant(this->currentInfo);
break;
@@ -169,6 +174,8 @@ void MenuManager::itemSelected(int userCode, const QString &menuName)
this->score->queueMovie(this->currentInfo + " -out");
this->score->queueMovie(this->currentInfo + " -buttons -out", Score::NEW_ANIMATION_ONLY);
this->score->queueMovie("back -out", Score::ONLY_IF_VISIBLE);
+ if(qmlRoot)
+ qmlRoot->setProperty("show", QVariant(false));
// book-keeping:
this->currentMenuCode = ROOT;
this->currentMenu = menuName + " -menu1";
@@ -191,6 +198,8 @@ void MenuManager::itemSelected(int userCode, const QString &menuName)
this->score->queueMovie(this->currentMenu + " -out", Score::FROM_START, Score::LOCK_ITEMS);
this->score->queueMovie(this->currentMenuButtons + " -out", Score::FROM_START, Score::LOCK_ITEMS);
this->score->queueMovie(this->currentInfo + " -out");
+ if(qmlRoot)
+ qmlRoot->setProperty("show", QVariant(false));
// book-keeping:
this->currentMenuCode = MENU1;
this->currentCategory = menuName;
@@ -208,6 +217,8 @@ void MenuManager::itemSelected(int userCode, const QString &menuName)
// out:
this->score->queueMovie(this->currentInfo + " -out", Score::NEW_ANIMATION_ONLY);
this->score->queueMovie(this->currentInfo + " -buttons -out", Score::NEW_ANIMATION_ONLY);
+ if(qmlRoot)
+ qmlRoot->setProperty("show", QVariant(false));
// book-keeping:
this->currentMenuCode = MENU2;
this->currentInfo = menuName;
@@ -242,6 +253,8 @@ void MenuManager::itemSelected(int userCode, const QString &menuName)
// out:
this->score->queueMovie(this->currentInfo + " -out", Score::NEW_ANIMATION_ONLY);
this->score->queueMovie(this->currentInfo + " -buttons -out", Score::NEW_ANIMATION_ONLY);
+ if(qmlRoot)
+ qmlRoot->setProperty("show", QVariant(false));
// book-keeping:
this->currentMenuCode = MENU1;
this->currentMenuButtons = this->currentCategory + " -buttons";
@@ -343,6 +356,35 @@ void MenuManager::launchExample(const QString &name)
#endif
}
+void MenuManager::launchQmlExample(const QString &name)
+{
+ if(!qmlRoot){
+ exampleError(QProcess::UnknownError);
+ return;
+ }
+ //resolveQmlFilename - refactor to separate fn?
+ QString dirName = this->info[name]["dirname"];
+ QString category = this->info[name]["category"];
+ QString fileName = this->info[name]["filename"];
+ QDir dir;
+ if (category == "demos")
+ dir = QDir(QLibraryInfo::location(QLibraryInfo::DemosPath));
+ else
+ dir = QDir(QLibraryInfo::location(QLibraryInfo::ExamplesPath));
+ QFile file(dir.path() + "/" + dirName + "/" + fileName + "/" + fileName.split('/').last() + ".qml");
+ if(!file.exists()){
+ //try main.qml as well
+ file.setFileName(dir.path() + "/" + dirName + "/" + fileName + "/" + "main.qml");
+ if(!file.exists()){
+ exampleError(QProcess::UnknownError);
+ return;
+ }
+ }
+
+ qmlRoot->setProperty("show", QVariant(true));
+ qmlRoot->setProperty("source", file.fileName());
+}
+
void MenuManager::exampleFinished()
{
}
@@ -359,6 +401,15 @@ void MenuManager::init(MainWindow *window)
{
this->window = window;
+ //Create blur for later use
+ // Note that blur is DISABLED by default because it's too slow, even on Desktop machines
+ if(!Colors::noBlur){
+ this->mainSceneBlur = new QGraphicsBlurEffect(this);
+ this->mainSceneBlur->setEnabled(false);
+ this->mainSceneBlur->setBlurRadius(0);
+ this->window->mainSceneRoot->setGraphicsEffect(mainSceneBlur);
+ }
+
// Create div:
this->createTicker();
this->createUpnDownButtons();
@@ -385,6 +436,37 @@ void MenuManager::init(MainWindow *window)
level2MenuNode = level2MenuNode.nextSibling();
}
+
+ // Create QML Loader
+ qmlRegisterType<QGraphicsBlurEffect>("Effects", 1, 0, "Blur");
+ declarativeEngine = new QDeclarativeEngine(this);
+ MenuManager::instance()->declarativeEngine->rootContext()->setContextProperty("realBlur", this->mainSceneBlur);
+ QDeclarativeComponent component(declarativeEngine, QUrl("qrc:qml/qmlShell.qml"), this);
+ qmlRoot = 0;
+ if(component.isReady())
+ qmlRoot = qobject_cast<QDeclarativeItem*>(component.create());
+ else
+ qDebug() << component.status() << component.errorString();
+ if(qmlRoot){
+ qmlRoot->setHeight(this->window->scene->sceneRect().height());
+ qmlRoot->setWidth(this->window->scene->sceneRect().width());
+ qmlRoot->setZValue(1000);//Above other items
+ qmlRoot->setCursor(Qt::ArrowCursor);
+ window->scene->addItem(qmlRoot);
+ if(!Colors::noBlur){
+ qmlShadow = new QGraphicsDropShadowEffect(this);
+ qmlShadow->setOffset(4);
+ qmlRoot->setGraphicsEffect(qmlShadow);
+ }
+
+ //Note that QML adds key handling to the app.
+ window->viewport()->setFocusPolicy(Qt::NoFocus);//Correct keyboard focus handling
+ window->setFocusPolicy(Qt::StrongFocus);
+ window->scene->setStickyFocus(true);
+ window->setFocus();
+ }else{
+ qDebug() << "Error intializing QML subsystem, Declarative examples will not work";
+ }
}
void MenuManager::readInfoAboutExample(const QDomElement &example)
@@ -392,13 +474,14 @@ void MenuManager::readInfoAboutExample(const QDomElement &example)
QString name = example.attribute("name");
if (this->info.contains(name))
qWarning() << "__WARNING: MenuManager::readInfoAboutExample: Demo/example with name"
- << name << "appears twize in the xml-file!__";
+ << name << "appears twice in the xml-file!__";
this->info[name]["filename"] = example.attribute("filename");
this->info[name]["category"] = example.parentNode().toElement().tagName();
this->info[name]["dirname"] = example.parentNode().toElement().attribute("dirname");
this->info[name]["changedirectory"] = example.attribute("changedirectory");
this->info[name]["image"] = example.attribute("image");
+ this->info[name]["qml"] = example.attribute("qml");
}
QString MenuManager::resolveDataDir(const QString &name)
@@ -454,7 +537,7 @@ QString MenuManager::resolveDocUrl(const QString &name)
QString fileName = this->info[name]["filename"];
if (category == "demos")
- return this->helpRootUrl + "demos-" + fileName + ".html";
+ return this->helpRootUrl + "demos-" + fileName.replace("/", "-") + ".html";
else
return this->helpRootUrl + dirName.replace("/", "-") + "-" + fileName + ".html";
}
@@ -474,6 +557,9 @@ QByteArray MenuManager::getImage(const QString &name)
QString imageName = this->info[name]["image"];
QString category = this->info[name]["category"];
QString fileName = this->info[name]["filename"];
+ bool qml = (this->info[name]["qml"] == QLatin1String("true"));
+ if(qml)
+ fileName = QLatin1String("qml-") + fileName.split('/').last();
if (imageName.isEmpty()){
if (category == "demos")
@@ -493,7 +579,7 @@ void MenuManager::createRootMenu(const QDomElement &el)
{
QString name = el.attribute("name");
createMenu(el, MENU1);
- createInfo(new MenuContentItem(el, this->window->scene, 0), name + " -info");
+ createInfo(new MenuContentItem(el, this->window->scene, this->window->mainSceneRoot), name + " -info");
Movie *menuButtonsIn = this->score->insertMovie(name + " -buttons");
Movie *menuButtonsOut = this->score->insertMovie(name + " -buttons -out");
@@ -505,19 +591,21 @@ void MenuManager::createSubMenu(const QDomElement &el)
{
QString name = el.attribute("name");
createMenu(el, MENU2);
- createInfo(new MenuContentItem(el, this->window->scene, 0), name + " -info");
+ createInfo(new MenuContentItem(el, this->window->scene, this->window->mainSceneRoot), name + " -info");
}
void MenuManager::createLeafMenu(const QDomElement &el)
{
QString name = el.attribute("name");
- createInfo(new ExampleContent(name, this->window->scene, 0), name);
+ createInfo(new ExampleContent(name, this->window->scene, this->window->mainSceneRoot), name);
Movie *infoButtonsIn = this->score->insertMovie(name + " -buttons");
Movie *infoButtonsOut = this->score->insertMovie(name + " -buttons -out");
createLowRightLeafButton("Documentation", 600, DOCUMENTATION, infoButtonsIn, infoButtonsOut, 0);
if (el.attribute("executable") != "false")
createLowRightLeafButton("Launch", 405, LAUNCH, infoButtonsIn, infoButtonsOut, 0);
+ else if(el.attribute("qml") == "true")
+ createLowRightLeafButton("Display", 405, LAUNCH_QML, infoButtonsIn, infoButtonsOut, 0);
}
void MenuManager::createMenu(const QDomElement &category, BUTTON_TYPE type)
@@ -546,7 +634,7 @@ void MenuManager::createMenu(const QDomElement &category, BUTTON_TYPE type)
// create normal menu button
QString label = currentNode.toElement().attribute("name");
- item = new TextButton(label, TextButton::LEFT, type, this->window->scene, 0);
+ item = new TextButton(label, TextButton::LEFT, type, this->window->scene, this->window->mainSceneRoot);
currentNode = currentNode.nextSibling();
#ifndef QT_OPENGL_SUPPORT
@@ -646,7 +734,7 @@ void MenuManager::createMenu(const QDomElement &category, BUTTON_TYPE type)
void MenuManager::createLowLeftButton(const QString &label, BUTTON_TYPE type,
Movie *movieIn, Movie *movieOut, Movie *movieShake, const QString &menuString)
{
- TextButton *button = new TextButton(label, TextButton::RIGHT, type, this->window->scene, 0, TextButton::PANEL);
+ TextButton *button = new TextButton(label, TextButton::RIGHT, type, this->window->scene, this->window->mainSceneRoot, TextButton::PANEL);
if (!menuString.isNull())
button->setMenuString(menuString);
button->setRecursiveVisible(false);
@@ -688,7 +776,7 @@ void MenuManager::createLowLeftButton(const QString &label, BUTTON_TYPE type,
void MenuManager::createLowRightButton(const QString &label, BUTTON_TYPE type, Movie *movieIn, Movie *movieOut, Movie * /*movieShake*/)
{
- TextButton *item = new TextButton(label, TextButton::RIGHT, type, this->window->scene, 0, TextButton::PANEL);
+ TextButton *item = new TextButton(label, TextButton::RIGHT, type, this->window->scene, this->window->mainSceneRoot, TextButton::PANEL);
item->setRecursiveVisible(false);
item->setZValue(10);
@@ -715,7 +803,7 @@ void MenuManager::createLowRightButton(const QString &label, BUTTON_TYPE type, M
void MenuManager::createLowRightLeafButton(const QString &label, int xOffset, BUTTON_TYPE type, Movie *movieIn, Movie *movieOut, Movie * /*movieShake*/)
{
- TextButton *item = new TextButton(label, TextButton::RIGHT, type, this->window->scene, 0, TextButton::PANEL);
+ TextButton *item = new TextButton(label, TextButton::RIGHT, type, this->window->scene, this->window->mainSceneRoot, TextButton::PANEL);
item->setRecursiveVisible(false);
item->setZValue(10);
@@ -831,12 +919,12 @@ void MenuManager::createUpnDownButtons()
float xOffset = 15.0f;
float yOffset = 450.0f;
- this->upButton = new TextButton("", TextButton::LEFT, MenuManager::UP, this->window->scene, 0, TextButton::UP);
+ this->upButton = new TextButton("", TextButton::LEFT, MenuManager::UP, this->window->scene, this->window->mainSceneRoot, TextButton::UP);
this->upButton->prepare();
this->upButton->setPos(xOffset, yOffset);
this->upButton->setState(TextButton::DISABLED);
- this->downButton = new TextButton("", TextButton::LEFT, MenuManager::DOWN, this->window->scene, 0, TextButton::DOWN);
+ this->downButton = new TextButton("", TextButton::LEFT, MenuManager::DOWN, this->window->scene, this->window->mainSceneRoot, TextButton::DOWN);
this->downButton->prepare();
this->downButton->setPos(xOffset + 10 + this->downButton->sceneBoundingRect().width(), yOffset);
diff --git a/demos/qtdemo/menumanager.h b/demos/qtdemo/menumanager.h
index ff98341..3524081 100644
--- a/demos/qtdemo/menumanager.h
+++ b/demos/qtdemo/menumanager.h
@@ -61,7 +61,7 @@ class MenuManager : public QObject
Q_OBJECT
public:
- enum BUTTON_TYPE {ROOT, MENU1, MENU2, LAUNCH, DOCUMENTATION, QUIT, FULLSCREEN, UP, DOWN, BACK};
+ enum BUTTON_TYPE {ROOT, MENU1, MENU2, LAUNCH, DOCUMENTATION, QUIT, FULLSCREEN, UP, DOWN, BACK, LAUNCH_QML};
// singleton pattern:
static MenuManager *instance();
@@ -83,6 +83,11 @@ public:
Score *score;
int currentMenuCode;
+ QDeclarativeEngine* declarativeEngine;
+ QDeclarativeItem *qmlRoot;
+ QGraphicsBlurEffect *mainSceneBlur;
+ QGraphicsDropShadowEffect *qmlShadow;
+
private slots:
void exampleFinished();
void exampleError(QProcess::ProcessError error);
@@ -100,6 +105,7 @@ private:
void readInfoAboutExample(const QDomElement &example);
void showDocInAssistant(const QString &docFile);
void launchExample(const QString &uniqueName);
+ void launchQmlExample(const QString &uniqueName);
void createMenu(const QDomElement &category, BUTTON_TYPE type);
void createLowLeftButton(const QString &label, BUTTON_TYPE type,
@@ -128,6 +134,7 @@ private:
TextButton *upButton;
TextButton *downButton;
+
};
#endif // MENU_MANAGER_H
diff --git a/demos/qtdemo/qmlShell.qml b/demos/qtdemo/qmlShell.qml
new file mode 100644
index 0000000..eb155c4
--- /dev/null
+++ b/demos/qtdemo/qmlShell.qml
@@ -0,0 +1,158 @@
+/****************************************************************************
+**
+** 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 demonstration applications 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 Qt 4.7
+import Effects 1.0
+
+Item {
+ id: main
+ property alias source: loader.source
+ property bool show: false
+ x: 0
+ y: -500 //height and width set by program
+ opacity: 0
+ property QtObject blurEffect: realBlur == null ? dummyBlur : realBlur //Is there a better way to lose those error messages?
+ Loader{//Automatic FocusScope
+ focus: true
+ clip: true
+ id: loader //source set by program
+ anchors.centerIn: parent
+ onStatusChanged: if(status == Loader.Ready) {
+ if(loader.item.width > 640)
+ loader.item.width = 640;
+ if(loader.item.height > 480)
+ loader.item.height = 480;
+ }
+
+ }
+ Rectangle{
+ z: -1
+ anchors.fill: loader.status == Loader.Ready ? loader : errorTxt
+ anchors.margins: -10
+ radius: 12
+ smooth: true
+ gradient: Gradient{
+ GradientStop{ position: 0.0; color: "#14FFFFFF" }
+ GradientStop{ position: 1.0; color: "#5AFFFFFF" }
+ }
+ MouseArea{
+ anchors.fill: parent
+ onClicked: loader.focus=true;/* and don't propogate to the 'exit' area*/
+ }
+
+ }
+
+ MouseArea{
+ z: -2
+ hoverEnabled: true //To steal from the buttons
+ anchors.fill: parent
+ onClicked: main.show=false;
+ }
+
+ Text{
+ id: errorTxt
+ anchors.centerIn: parent
+ color: 'white'
+ smooth: true
+ visible: loader.status == Loader.Error
+ textFormat: Text.RichText //includes link for bugreport
+ //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. 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);
+ }
+
+
+ states: [
+ State {
+ name: "show"
+ when: show == true
+ PropertyChanges {
+ target: main
+ opacity: 1
+ y: 0
+ }
+ PropertyChanges {
+ target: blurEffect
+ enabled: true
+ blurRadius: 8
+ blurHints: Blur.AnimationHint | Blur.PerformanceHint
+ }
+ }
+ ]
+ MagicAnim{ id: magicAnim; target: main; from: -500; to: 0 }
+ transitions: [
+ Transition { from: ""; to: "show"
+ SequentialAnimation{
+ ScriptAction{ script: magicAnim.start() }
+ NumberAnimation{ properties: "opacity,blurRadius"; easing.type: Easing.OutCubic; duration: 1000}
+ PropertyAnimation{ target: main; property: "y"}
+ }
+
+ },
+ Transition { from: "show"; to: "" //Addtionally, unload the item
+ SequentialAnimation{
+ NumberAnimation{ properties: "y,opacity,blurRadius";duration: 500 }
+ ScriptAction{ script: loader.source = ''; }
+ }
+ /*Attempt to copy the exeunt animation. Looks bad
+ SequentialAnimation{
+ ParallelAnimation{
+ NumberAnimation{ properties: "opacity,blurRadius"; easing.type: Easing.InCubic; duration: 1000 }
+ SequentialAnimation{
+ NumberAnimation{ target: main; property: 'y'; to: 3.2*height/5; duration: 500}
+ ParallelAnimation{
+ NumberAnimation{ target: main; property: 'y'; to: 3.0*height/5; duration: 100}
+ NumberAnimation{ target: main; property: 'x'; to: 3.0*width/5; duration: 100}
+ }
+ NumberAnimation{ target: main; property: 'x'; to: 700; duration: 400}
+ }
+ }
+ ScriptAction{ script: loader.source = ''; }
+ PropertyAction{ properties: "x,y";}
+ }
+ */
+ }
+ ]
+ Item{ Blur{id: dummyBlur } }
+
+}
diff --git a/demos/qtdemo/qtdemo.pro b/demos/qtdemo/qtdemo.pro
index 2a776ac..5e64e1c 100644
--- a/demos/qtdemo/qtdemo.pro
+++ b/demos/qtdemo/qtdemo.pro
@@ -6,7 +6,7 @@ DESTDIR = $$DEMO_DESTDIR/bin
INSTALLS += target sources
-QT += xml network
+QT += xml network declarative
contains(QT_CONFIG, opengl) {
DEFINES += QT_OPENGL_SUPPORT
@@ -74,3 +74,6 @@ target.path = $$[QT_INSTALL_BINS]
sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES qtdemo.pro images xml *.ico *.icns *.rc *.plist
sources.path = $$[QT_INSTALL_DEMOS]/qtdemo
+OTHER_FILES += \
+ qmlShell.qml \
+ MagicAnim.qml
diff --git a/demos/qtdemo/qtdemo.qrc b/demos/qtdemo/qtdemo.qrc
index b30dd58..7682ab5 100644
--- a/demos/qtdemo/qtdemo.qrc
+++ b/demos/qtdemo/qtdemo.qrc
@@ -1,8 +1,12 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/">
- <file>xml/examples.xml</file>
- <file>images/qtlogo_small.png</file>
- <file>images/trolltech-logo.png</file>
- <file>images/demobg.png</file>
-</qresource>
+<RCC>
+ <qresource prefix="/">
+ <file>xml/examples.xml</file>
+ <file>images/qtlogo_small.png</file>
+ <file>images/trolltech-logo.png</file>
+ <file>images/demobg.png</file>
+ </qresource>
+ <qresource prefix="/qml" lang="qml">
+ <file>qmlShell.qml</file>
+ <file>MagicAnim.qml</file>
+ </qresource>
</RCC>
diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml
index 9121861..0ab048e 100644
--- a/demos/qtdemo/xml/examples.xml
+++ b/demos/qtdemo/xml/examples.xml
@@ -1,25 +1,32 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<categories name="Qt Examples and Demos">
<demos dirname="." docname="demos" name="Demonstrations">
+ <example filename="declarative/samegame" name="SameGame" executable="false" qml="true"/>
+ <example filename="declarative/flickr" name="Flickr Client" executable="false" qml="true"/>
<example filename="affine" name="Affine Transformations" />
- <example filename="arthurplugin" name="Arthur Plugin" executable="false" />
<example filename="composition" name="Composition Modes" />
<example filename="gradients" name="Gradients" />
<example filename="pathstroke" name="Path Stroking" />
- <example filename="deform" name="Vector Deformation" />
- <example filename="books" name="Books" />
- <example filename="mainwindow" name="Main Window" />
- <example filename="spreadsheet" name="Spreadsheet" />
- <example filename="sqlbrowser" name="SQL Browser" />
<example filename="textedit" name="Text Edit" />
<example filename="chip" name="40000 Chips" />
<example filename="embeddeddialogs" name="Embedded Dialogs" />
<example filename="interview" name="Interview" />
+ <example filename="declarative/rssnews" name="Rss Client" executable="false" qml="true"/>
+ <example filename="declarative/twitter" name="Twitter Client" executable="false" qml="true"/>
<example filename="browser" name="Browser" />
<example filename="qmediaplayer" name="Media Player" />
<example filename="boxes" name="Boxes" />
<example filename="sub-attaq" name="Sub-attaq" />
<example filename="spectrum" name="Spectrum Analyzer" />
+ <example filename="declarative/minehunt" name="Minehunt" executable="false" qml="true"/>
+ <example filename="declarative/snake" name="Snake" executable="false" qml="true"/>
+ <example filename="deform" name="Vector Deformation" />
+ <example filename="books" name="Books" />
+ <example filename="mainwindow" name="Main Window" />
+ <example filename="spreadsheet" name="Spreadsheet" />
+ <example filename="sqlbrowser" name="SQL Browser" />
+ <example filename="arthurplugin" name="Arthur Plugin" executable="false" />
+
</demos>
<category dirname="animation" name="Animation Framework">
<example filename="animatedtiles" name="Animated Tiles" />
@@ -35,6 +42,13 @@
<example filename="runfunction" name="Run Function" executable="false"/>
<example filename="wordcount" name="Word Count" executable="false" />
</category>
+ <category dirname="declarative/toys" name="Qt Declarative Examples">
+ <example filename="dynamicscene" name="Dynamic Scene" executable="false" qml="true" />
+ <example filename="tic-tac-toe" name="Tic Tac Toe" executable="false" qml="true" />
+ <example filename="clocks" name="Clocks" executable="false" qml="true" />
+ <example filename="corkboards" name="Corkboards" executable="false" qml="true" />
+ <example filename="tvtennis" name="TV Tennis" executable="false" qml="true" />
+ </category>
<category dirname="designer" name="Qt Designer">
<example filename="calculatorbuilder" name="Calculator Builder" />
<example filename="calculatorform" name="Calculator Form" />
@@ -116,6 +130,16 @@
<example filename="menus" name="Menus" />
<example filename="recentfiles" name="Recent Files" />
</category>
+ <category dirname="declarative/ui-components" name="QML UI Components">
+ <example filename="dialcontrol" name="Dial" executable="false" qml="true" />
+ <example filename="flipable" name="Flipable" executable="false" qml="true" />
+ <example filename="progressbar" name="Progress bar" executable="false" qml="true" />
+ <example filename="scrollbar" name="Scroll bar" executable="false" qml="true" />
+ <example filename="searchbox" name="Search box" executable="false" qml="true" />
+ <example filename="slideswitch" name="Slide switch" executable="false" qml="true" />
+ <example filename="spinner" name="Spinner" executable="false" qml="true" />
+ <example filename="tabwidget" name="Tab widget" executable="false" qml="true" />
+ </category>
<category dirname="network" name="Networking">
<example filename="blockingfortuneclient" name="Blocking Fortune Client" />
<example filename="broadcastreceiver" name="Broadcast Receiver" />
diff --git a/demos/spectrum/3rdparty/fftreal/fftreal.pro b/demos/spectrum/3rdparty/fftreal/fftreal.pro
index 4ab9652..5dd02a4 100644
--- a/demos/spectrum/3rdparty/fftreal/fftreal.pro
+++ b/demos/spectrum/3rdparty/fftreal/fftreal.pro
@@ -38,4 +38,10 @@ symbian {
}
}
+# Install
+
+sources.files = $$SOURCES $$HEADERS fftreal.pro readme.txt license.txt
+sources.files += bwins/fftreal.def eabi/fftreal.def
+sources.path = $$[QT_INSTALL_DEMOS]/spectrum/3rdparty/fftreal
+INSTALLS += sources
diff --git a/demos/spectrum/app/app.pro b/demos/spectrum/app/app.pro
index 257675c..a80ae9b 100644
--- a/demos/spectrum/app/app.pro
+++ b/demos/spectrum/app/app.pro
@@ -71,6 +71,13 @@ symbian {
}
}
+# Install
+
+sources.files = $$SOURCES $$HEADERS $$RESOURCES app.pro
+sources.path = $$[QT_INSTALL_DEMOS]/spectrum/app
+images.files += images/record.png images/settings.png
+images.path = $$[QT_INSTALL_DEMOS]/spectrum/app/images
+INSTALLS += sources images
# Deployment
@@ -112,7 +119,7 @@ symbian {
# the dynamic library can be located.
copy_launch_script.target = copy_launch_script
copy_launch_script.commands = \
- install -m 0555 $$PWD/spectrum.sh ../bin/spectrum
+ install -m 0555 $$QT_SOURCE_TREE/demos/spectrum/app/spectrum.sh ../bin/spectrum
QMAKE_EXTRA_TARGETS += copy_launch_script
POST_TARGETDEPS += copy_launch_script
}
diff --git a/demos/spectrum/spectrum.pro b/demos/spectrum/spectrum.pro
index 04bbdee..8736ba7 100644
--- a/demos/spectrum/spectrum.pro
+++ b/demos/spectrum/spectrum.pro
@@ -21,17 +21,9 @@ symbian {
# UID for the SIS file
TARGET.UID3 = 0xA000E3FA
-
- bin.sources = spectrum.exe
- !contains(DEFINES, DISABLE_FFT) {
- bin.sources += fftreal.dll
- }
- bin.path = /sys/bin
- rsc.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/spectrum.rsc
- rsc.path = $$APP_RESOURCE_DIR
- mif.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/spectrum.mif
- mif.path = $$APP_RESOURCE_DIR
- reg_rsc.sources = $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/spectrum_reg.rsc
- reg_rsc.path = $$REG_RESOURCE_IMPORT_DIR
- DEPLOYMENT += bin rsc mif reg_rsc
}
+
+sources.files = README.txt spectrum.pri spectrum.pro TODO.txt
+sources.path = $$[QT_INSTALL_DEMOS]/spectrum
+INSTALLS += sources
+