Changeset 846 for trunk/demos/qtdemo


Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
46 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/demos/qtdemo/colors.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/colors.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/demoitem.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/demoitem.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/demoitemanimation.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/demoitemanimation.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/demoscene.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/demoscene.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/demotextitem.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/demotextitem.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/dockitem.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/dockitem.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/examplecontent.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    8080{
    8181    QByteArray ba = MenuManager::instance()->getHtml(this->name);
     82    QString errorMsg;
     83    int errorLine, errorColumn;
    8284
    8385    QDomDocument exampleDoc;
    84     exampleDoc.setContent(ba, false);
     86    if (!exampleDoc.setContent(ba, false, &errorMsg, &errorLine, &errorColumn)) {
     87        qDebug() << errorMsg << errorLine << errorColumn;
     88    }
    8589
    8690    QDomNodeList paragraphs = exampleDoc.elementsByTagName("p");
    8791    if (paragraphs.length() < 1 && Colors::verbose)
    88         qDebug() << "- ExampleContent::loadDescription(): Could not load description:" << MenuManager::instance()->info[this->name]["docfile"];
    89     QString description = Colors::contentColor + QLatin1String("Could not load description. Ensure that the documentation for Qt is built.");
     92        qDebug() << "- ExampleContent::loadDescription(): Could not load description:"
     93                 << MenuManager::instance()->info[this->name]["docfile"];
     94    QString description = Colors::contentColor + QLatin1String("");
     95    //QLatin1String("Could not load description. Ensure that the documentation for Qt is built."); // QTBUG-12522: If there is no description why show an error to the user when qDebug above communications the issue (if it is indeed an issue at all) when demos are built?
    9096    for (int p = 0; p < int(paragraphs.length()); ++p) {
    9197        description = this->extractTextFromParagraph(paragraphs.item(p));
     
    100106{
    101107    return (!text.contains("[") &&
    102         text.indexOf(QRegExp(QString("(In )?((The|This) )?(%1 )?.*(tutorial|example|demo|application)").arg(this->name), Qt::CaseInsensitive)) != -1);
     108        text.indexOf(QRegExp(QString("(In )?((The|This) )?(%1 )?.*(tutorial|example|demo|application)").arg(this->name),
     109                             Qt::CaseInsensitive)) != -1);
    103110}
    104111
  • trunk/demos/qtdemo/examplecontent.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/guide.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/guide.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/guidecircle.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/guidecircle.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/guideline.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/guideline.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/headingitem.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/headingitem.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/imageitem.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/imageitem.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/itemcircleanimation.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/itemcircleanimation.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    6262    virtual ~ItemCircleAnimation();
    6363
    64     // overidden methods:
     64    // overridden methods:
    6565    QRectF boundingRect() const;
    6666    void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0);
  • trunk/demos/qtdemo/letteritem.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/letteritem.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/main.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/mainwindow.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    267267    if (Colors::showFps){
    268268        this->fpsLabel = new DemoTextItem(QString("FPS: --"), Colors::buttonFont(), Qt::white, -1, this->scene, 0, DemoTextItem::DYNAMIC_TEXT);
    269         this->fpsLabel->setZValue(100);
     269        this->fpsLabel->setZValue(1000);
    270270        this->fpsLabel->setPos(Colors::stageStartX, 600 - QFontMetricsF(Colors::buttonFont()).height() - 5);
    271271    }
    272272
    273     this->companyLogo = new ImageItem(QImage(":/images/trolltech-logo.png"), 1000, 1000, this->scene, 0, true, 0.5f);
    274     this->qtLogo = new ImageItem(QImage(":/images/qtlogo_small.png"), 1000, 1000, this->scene, 0, true, 0.5f);
     273    this->mainSceneRoot = new QGraphicsWidget();
     274    this->scene->addItem(mainSceneRoot);
     275    this->companyLogo = new ImageItem(QImage(":/images/trolltech-logo.png"), 1000, 1000, this->scene, mainSceneRoot, true, 0.5f);
     276    this->qtLogo = new ImageItem(QImage(":/images/qtlogo_small.png"), 1000, 1000, this->scene, mainSceneRoot, true, 0.5f);
    275277    this->companyLogo->setZValue(100);
    276278    this->qtLogo->setZValue(100);
     
    377379        QApplication::quit();
    378380    }
    379     else if (event->key() == Qt::Key_1){
     381    else if (event->key() == Qt::Key_F1){
    380382            QString s("");
    381383            s += "Rendering system: ";
     
    387389            s += "\nAdapt: ";
    388390            s += Colors::noAdapt ? "off" : "on";
    389             s += "\nAdaption occured: ";
     391            s += "\nAdaption occurred: ";
    390392            s += Colors::adapted ? "yes" : "no";
    391393            s += "\nOpenGL version: ";
     
    416418            QMessageBox::information(0, QString("Current configuration"), s);
    417419    }
     420    QGraphicsView::keyPressEvent(event);
    418421}
    419422
  • trunk/demos/qtdemo/mainwindow.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    6363
    6464    QGraphicsScene *scene;
     65    QGraphicsWidget* mainSceneRoot;
     66
    6567    bool loop;
    6668
     
    7375
    7476protected:
    75     // Overidden methods:
     77    // Overridden methods:
    7678    void showEvent(QShowEvent *event);
    7779    void keyPressEvent(QKeyEvent *event);
  • trunk/demos/qtdemo/menucontent.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/menucontent.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/menumanager.cpp

    r696 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    153153        this->launchExample(this->currentInfo);
    154154        break;
     155    case LAUNCH_QML:
     156        this->launchQmlExample(this->currentInfo);
     157        break;
    155158    case DOCUMENTATION:
    156159        this->showDocInAssistant(this->currentInfo);
     
    170173        this->score->queueMovie(this->currentInfo + " -buttons -out", Score::NEW_ANIMATION_ONLY);
    171174        this->score->queueMovie("back -out", Score::ONLY_IF_VISIBLE);
     175        if(qmlRoot)
     176            qmlRoot->setProperty("show", QVariant(false));
    172177        // book-keeping:
    173178        this->currentMenuCode = ROOT;
     
    192197        this->score->queueMovie(this->currentMenuButtons + " -out", Score::FROM_START, Score::LOCK_ITEMS);
    193198        this->score->queueMovie(this->currentInfo + " -out");
     199        if(qmlRoot)
     200            qmlRoot->setProperty("show", QVariant(false));
    194201        // book-keeping:
    195202        this->currentMenuCode = MENU1;
     
    209216        this->score->queueMovie(this->currentInfo + " -out", Score::NEW_ANIMATION_ONLY);
    210217        this->score->queueMovie(this->currentInfo + " -buttons -out", Score::NEW_ANIMATION_ONLY);
     218        if(qmlRoot)
     219            qmlRoot->setProperty("show", QVariant(false));
    211220        // book-keeping:
    212221        this->currentMenuCode = MENU2;
     
    243252            this->score->queueMovie(this->currentInfo + " -out", Score::NEW_ANIMATION_ONLY);
    244253            this->score->queueMovie(this->currentInfo + " -buttons -out", Score::NEW_ANIMATION_ONLY);
     254            if(qmlRoot)
     255                qmlRoot->setProperty("show", QVariant(false));
    245256            // book-keeping:
    246257            this->currentMenuCode = MENU1;
     
    303314    // was started to activate assistant and bring it to front:
    304315    QTextStream str(&this->assistantProcess);
    305     str << "SetSource " << url << QLatin1Char('\0') << endl;
     316    str << "SetSource " << url << QLatin1Char('\n') << endl;
    306317}
    307318
     
    344355}
    345356
     357void MenuManager::launchQmlExample(const QString &name)
     358{
     359#ifndef QT_NO_DECLARATIVE
     360    if(!qmlRoot){
     361        exampleError(QProcess::UnknownError);
     362        return;
     363    }
     364    //resolveQmlFilename - refactor to separate fn?
     365    QString dirName = this->info[name]["dirname"];
     366    QString category = this->info[name]["category"];
     367    QString fileName = this->info[name]["filename"];
     368    QDir dir;
     369    if (category == "demos")
     370        dir = QDir(QLibraryInfo::location(QLibraryInfo::DemosPath));
     371    else
     372        dir = QDir(QLibraryInfo::location(QLibraryInfo::ExamplesPath));
     373    QFile file(dir.path() + "/" + dirName + "/" + fileName + "/" + "main.qml");
     374    if(!file.exists()){
     375        //try dirname.qml as well
     376        file.setFileName(dir.path() + "/" + dirName + "/" + fileName + "/" + fileName.split('/').last() + ".qml");
     377        if(!file.exists()){
     378            exampleError(QProcess::UnknownError);
     379            return;
     380        }
     381    }
     382
     383    qmlRoot->setProperty("qmlFile", QVariant(""));//unload component
     384    qmlRoot->setProperty("show", QVariant(true));
     385    qmlRoot->setProperty("qmlFile", QUrl::fromLocalFile(file.fileName()));
     386#else
     387    exampleError(QProcess::UnknownError);
     388#endif
     389}
     390
     391void MenuManager::quitQML()
     392{
     393    if(qmlRoot)
     394        qmlRoot->setProperty("show", QVariant(false));
     395}
     396
    346397void MenuManager::exampleFinished()
    347398{
     
    386437        level2MenuNode = level2MenuNode.nextSibling();
    387438    }
     439
     440    qmlRoot = 0;
     441#ifndef QT_NO_DECLARATIVE
     442    // Create QML Loader
     443    declarativeEngine = new QDeclarativeEngine(this);
     444    connect(declarativeEngine, SIGNAL(quit()),
     445            this, SLOT(quitQML()));
     446
     447    QDeclarativeComponent component(declarativeEngine, QUrl("qrc:qml/qmlShell.qml"), this);
     448    QDeclarativeItem* qmlRootItem = 0;
     449    if(component.isReady()){
     450        qmlRoot = component.create();
     451        qmlRootItem = qobject_cast<QDeclarativeItem*>(qmlRoot);
     452    }else{
     453        qDebug() << component.status() << component.errorString();
     454    }
     455
     456    if(qmlRootItem){
     457        qmlRootItem->setHeight(this->window->scene->sceneRect().height());
     458        qmlRootItem->setWidth(this->window->scene->sceneRect().width());
     459        qmlRootItem->setZValue(101);//Above other items
     460        qmlRootItem->setCursor(Qt::ArrowCursor);
     461        window->scene->addItem(qmlRootItem);
     462
     463        //Note that QML adds key handling to the app.
     464        window->viewport()->setFocusPolicy(Qt::NoFocus);//Correct keyboard focus handling
     465        window->setFocusPolicy(Qt::StrongFocus);
     466        window->scene->setStickyFocus(true);
     467        window->setFocus();
     468    }else{
     469        qDebug() << "Error initializing QML subsystem, Declarative examples will not work";
     470    }
     471#endif
    388472}
    389473
     
    393477    if (this->info.contains(name))
    394478        qWarning() << "__WARNING: MenuManager::readInfoAboutExample: Demo/example with name"
    395                     << name << "appears twize in the xml-file!__";
     479                    << name << "appears twice in the xml-file!__";
    396480
    397481    this->info[name]["filename"] = example.attribute("filename");
     
    400484    this->info[name]["changedirectory"] = example.attribute("changedirectory");
    401485    this->info[name]["image"] = example.attribute("image");
     486    this->info[name]["qml"] = example.attribute("qml");
    402487}
    403488
     
    434519    dir.cd(fileName);
    435520
     521    fileName = fileName.split("/").last();
    436522    QFile unixFile(dir.path() + "/" + fileName);
    437523    if (unixFile.exists()) return unixFile.fileName();
     
    457543
    458544    if (category == "demos")
    459         return this->helpRootUrl + "demos-" + fileName + ".html";
     545        return this->helpRootUrl + "demos-" + fileName.replace("/", "-") + ".html";
    460546    else
    461547        return this->helpRootUrl + dirName.replace("/", "-") + "-" + fileName + ".html";
     
    477563    QString category = this->info[name]["category"];
    478564    QString fileName = this->info[name]["filename"];
     565    bool qml = (this->info[name]["qml"] == QLatin1String("true"));
     566    if(qml)
     567        fileName = QLatin1String("qml-") + fileName.split('/').last();
    479568
    480569    if (imageName.isEmpty()){
     
    496585    QString name = el.attribute("name");
    497586    createMenu(el, MENU1);
    498     createInfo(new MenuContentItem(el, this->window->scene, 0), name + " -info");
     587    createInfo(new MenuContentItem(el, this->window->scene, this->window->mainSceneRoot), name + " -info");
    499588
    500589    Movie *menuButtonsIn = this->score->insertMovie(name + " -buttons");
     
    508597    QString name = el.attribute("name");
    509598    createMenu(el, MENU2);
    510     createInfo(new MenuContentItem(el, this->window->scene, 0), name + " -info");
     599    createInfo(new MenuContentItem(el, this->window->scene, this->window->mainSceneRoot), name + " -info");
    511600}
    512601
     
    514603{
    515604    QString name = el.attribute("name");
    516     createInfo(new ExampleContent(name, this->window->scene, 0), name);
     605    createInfo(new ExampleContent(name, this->window->scene, this->window->mainSceneRoot), name);
    517606
    518607    Movie *infoButtonsIn = this->score->insertMovie(name + " -buttons");
     
    521610    if (el.attribute("executable") != "false")
    522611        createLowRightLeafButton("Launch", 405, LAUNCH, infoButtonsIn, infoButtonsOut, 0);
     612    else if(el.attribute("qml") == "true")
     613        createLowRightLeafButton("Display", 405, LAUNCH_QML, infoButtonsIn, infoButtonsOut, 0);
    523614}
    524615
     
    549640            // create normal menu button
    550641            QString label = currentNode.toElement().attribute("name");
    551             item = new TextButton(label, TextButton::LEFT, type, this->window->scene, 0);
     642            item = new TextButton(label, TextButton::LEFT, type, this->window->scene, this->window->mainSceneRoot);
    552643            currentNode = currentNode.nextSibling();
    553644
     
    649740    Movie *movieIn, Movie *movieOut, Movie *movieShake, const QString &menuString)
    650741{
    651     TextButton *button = new TextButton(label, TextButton::RIGHT, type, this->window->scene, 0, TextButton::PANEL);
     742    TextButton *button = new TextButton(label, TextButton::RIGHT, type, this->window->scene, this->window->mainSceneRoot, TextButton::PANEL);
    652743    if (!menuString.isNull())
    653744        button->setMenuString(menuString);
     
    691782void MenuManager::createLowRightButton(const QString &label, BUTTON_TYPE type, Movie *movieIn, Movie *movieOut, Movie * /*movieShake*/)
    692783{
    693     TextButton *item = new TextButton(label, TextButton::RIGHT, type, this->window->scene, 0, TextButton::PANEL);
     784    TextButton *item = new TextButton(label, TextButton::RIGHT, type, this->window->scene, this->window->mainSceneRoot, TextButton::PANEL);
    694785    item->setRecursiveVisible(false);
    695786    item->setZValue(10);
     
    718809void MenuManager::createLowRightLeafButton(const QString &label, int xOffset, BUTTON_TYPE type, Movie *movieIn, Movie *movieOut, Movie * /*movieShake*/)
    719810{
    720     TextButton *item = new TextButton(label, TextButton::RIGHT, type, this->window->scene, 0, TextButton::PANEL);
     811    TextButton *item = new TextButton(label, TextButton::RIGHT, type, this->window->scene, this->window->mainSceneRoot, TextButton::PANEL);
    721812    item->setRecursiveVisible(false);
    722813    item->setZValue(10);
     
    834925    float yOffset = 450.0f;
    835926
    836     this->upButton = new TextButton("", TextButton::LEFT, MenuManager::UP, this->window->scene, 0, TextButton::UP);
     927    this->upButton = new TextButton("", TextButton::LEFT, MenuManager::UP, this->window->scene, this->window->mainSceneRoot, TextButton::UP);
    837928    this->upButton->prepare();
    838929    this->upButton->setPos(xOffset, yOffset);
    839930    this->upButton->setState(TextButton::DISABLED);
    840931
    841     this->downButton = new TextButton("", TextButton::LEFT, MenuManager::DOWN, this->window->scene, 0, TextButton::DOWN);
     932    this->downButton = new TextButton("", TextButton::LEFT, MenuManager::DOWN, this->window->scene, this->window->mainSceneRoot, TextButton::DOWN);
    842933    this->downButton->prepare();
    843934    this->downButton->setPos(xOffset + 10 + this->downButton->sceneBoundingRect().width(), yOffset);
  • trunk/demos/qtdemo/menumanager.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4646#include <QtXml>
    4747#include <QtHelp/QHelpEngineCore>
     48#ifndef QT_NO_DECLARATIVE
     49#include <QtDeclarative>
     50#endif
    4851
    4952#include "score.h"
     
    6265
    6366public:
    64     enum BUTTON_TYPE {ROOT, MENU1, MENU2, LAUNCH, DOCUMENTATION, QUIT, FULLSCREEN, UP, DOWN, BACK};
     67    enum BUTTON_TYPE {ROOT, MENU1, MENU2, LAUNCH, DOCUMENTATION, QUIT, FULLSCREEN, UP, DOWN, BACK, LAUNCH_QML};
    6568
    6669    // singleton pattern:
     
    8487    int currentMenuCode;
    8588
     89    QObject *qmlRoot;
     90#ifndef QT_NO_DECLARATIVE
     91    QDeclarativeEngine* declarativeEngine;
     92#endif
     93
    8694private slots:
    8795    void exampleFinished();
    8896    void exampleError(QProcess::ProcessError error);
     97
     98    void quitQML();
    8999
    90100private:
     
    101111    void showDocInAssistant(const QString &docFile);
    102112    void launchExample(const QString &uniqueName);
     113    void launchQmlExample(const QString &uniqueName);
    103114
    104115    void createMenu(const QDomElement &category, BUTTON_TYPE type);
     
    129140    TextButton *upButton;
    130141    TextButton *downButton;
     142
    131143};
    132144
  • trunk/demos/qtdemo/qtdemo.pro

    r695 r846  
    1 CONFIG += assistant help x11inc
     1CONFIG += help x11inc
    22TARGET = qtdemo
    33DEMO_DESTDIR = $$QT_BUILD_TREE
     
    1212    DEFINES += QT_OPENGL_SUPPORT
    1313    QT += opengl
     14}
     15
     16contains(QT_CONFIG, declarative) {
     17    QT += declarative
    1418}
    1519
     
    7680sources.path = $$[QT_INSTALL_DEMOS]/qtdemo
    7781
     82OTHER_FILES += \
     83    qmlShell.qml
  • trunk/demos/qtdemo/qtdemo.qrc

    r2 r846  
    1 <!DOCTYPE RCC><RCC version="1.0">
    2 <qresource prefix="/">
    3    <file>xml/examples.xml</file>
    4    <file>images/qtlogo_small.png</file>
    5    <file>images/trolltech-logo.png</file>
    6    <file>images/demobg.png</file>
    7 </qresource>
     1<RCC>
     2    <qresource prefix="/">
     3        <file>xml/examples.xml</file>
     4        <file>images/qtlogo_small.png</file>
     5        <file>images/trolltech-logo.png</file>
     6        <file>images/demobg.png</file>
     7    </qresource>
     8    <qresource prefix="/qml" lang="qml">
     9        <file>qmlShell.qml</file>
     10    </qresource>
    811</RCC>
  • trunk/demos/qtdemo/qtdemo.rc

    r651 r846  
    1919            VALUE "FileDescription", "Qt Examples and Demos"
    2020            VALUE "FileVersion", "1.0.0.0"
    21             VALUE "LegalCopyright", "Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)."
     21            VALUE "LegalCopyright", "Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)."
    2222            VALUE "InternalName", "qtdemo"
    2323            VALUE "OriginalFilename", "qtdemo.exe"
  • trunk/demos/qtdemo/scanitem.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/scanitem.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/score.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/score.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/textbutton.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/demos/qtdemo/textbutton.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    6262    virtual ~TextButton();
    6363
    64     // overidden methods:
     64    // overridden methods:
    6565    virtual QRectF boundingRect() const;
    6666    virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0){};
  • trunk/demos/qtdemo/xml/examples.xml

    r769 r846  
    22<categories name="Qt Examples and Demos">
    33  <demos dirname="." docname="demos" name="Demonstrations">
     4    <example filename="declarative/samegame" name="SameGame" executable="false" qml="true"/>
     5    <example filename="declarative/flickr" name="Flickr Client" executable="false" qml="true"/>
    46    <example filename="affine" name="Affine Transformations" />
    5     <example filename="arthurplugin" name="Arthur Plugin" executable="false" />
    67    <example filename="composition" name="Composition Modes" />
    78    <example filename="gradients" name="Gradients" />
    89    <example filename="pathstroke" name="Path Stroking" />
     10    <example filename="textedit" name="Text Edit" />
     11    <example filename="chip" name="40000 Chips" />
     12    <example filename="embeddeddialogs" name="Embedded Dialogs" />
     13    <example filename="interview" name="Interview" />
     14    <example filename="declarative/rssnews" name="Rss Client" executable="false" qml="true"/>
     15    <example filename="declarative/twitter" name="Twitter Client" executable="false" qml="true"/>
     16    <example filename="browser" name="Browser" />
     17    <example filename="qmediaplayer" name="Media Player" />
     18    <example filename="boxes" name="Boxes" />
     19    <example filename="sub-attaq" name="Sub-attaq" />
     20    <example filename="spectrum" name="Spectrum Analyzer" />
     21    <example filename="declarative/minehunt" name="Minehunt"/>
    922    <example filename="deform" name="Vector Deformation" />
    1023    <example filename="books" name="Books" />
     
    1225    <example filename="spreadsheet" name="Spreadsheet" />
    1326    <example filename="sqlbrowser" name="SQL Browser" />
    14     <example filename="textedit" name="Text Edit" />
    15     <example filename="chip" name="40000 Chips" />
    16     <example filename="embeddeddialogs" name="Embedded Dialogs" />
    17     <example filename="interview" name="Interview" />
    18     <example filename="browser" name="Browser" />
    19     <example filename="qmediaplayer" name="Media Player" />
    20     <example filename="boxes" name="Boxes" />
    21     <example filename="sub-attaq" name="Sub-attaq" />
    22     <example filename="spectrum" name="Spectrum Analyzer" />
     27    <example filename="arthurplugin" name="Arthur Plugin" executable="false" />
     28
    2329  </demos>
    2430  <category dirname="animation" name="Animation Framework">
     
    3541    <example filename="runfunction" name="Run Function" executable="false"/>
    3642    <example filename="wordcount" name="Word Count" executable="false" />
     43  </category>
     44  <category dirname="declarative/toys" name="Qt Declarative Examples">
     45    <example filename="dynamicscene" name="Dynamic Scene" executable="false" qml="true" />
     46    <example filename="tic-tac-toe" name="Tic Tac Toe" executable="false" qml="true" />
     47    <example filename="clocks" name="Clocks" executable="false" qml="true" />
     48    <example filename="corkboards" name="Corkboards" executable="false" qml="true" />
     49    <example filename="tvtennis" name="TV Tennis" executable="false" qml="true" />
    3750  </category>
    3851  <category dirname="designer" name="Qt Designer">
     
    116129    <example filename="menus" name="Menus" />
    117130    <example filename="recentfiles" name="Recent Files" />
     131  </category>
     132  <category dirname="declarative/ui-components" name="QML UI Components">
     133    <example filename="dialcontrol" name="Dial" executable="false" qml="true" />
     134    <example filename="flipable" name="Flipable" executable="false" qml="true" />
     135    <example filename="progressbar" name="Progress bar" executable="false" qml="true" />
     136    <example filename="scrollbar" name="Scroll bar" executable="false" qml="true" />
     137    <example filename="searchbox" name="Search box" executable="false" qml="true" />
     138    <example filename="slideswitch" name="Slide switch" executable="false" qml="true" />
     139    <example filename="spinner" name="Spinner" executable="false" qml="true" />
     140    <example filename="tabwidget" name="Tab widget" executable="false" qml="true" />
    118141  </category>
    119142  <category dirname="network" name="Networking">
Note: See TracChangeset for help on using the changeset viewer.