Changeset 846 for trunk/demos/qtdemo
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 46 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/demos/qtdemo/colors.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/colors.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/demoitem.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/demoitem.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/demoitemanimation.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/demoitemanimation.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/demoscene.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/demoscene.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/demotextitem.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/demotextitem.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/dockitem.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/dockitem.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/examplecontent.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 80 80 { 81 81 QByteArray ba = MenuManager::instance()->getHtml(this->name); 82 QString errorMsg; 83 int errorLine, errorColumn; 82 84 83 85 QDomDocument exampleDoc; 84 exampleDoc.setContent(ba, false); 86 if (!exampleDoc.setContent(ba, false, &errorMsg, &errorLine, &errorColumn)) { 87 qDebug() << errorMsg << errorLine << errorColumn; 88 } 85 89 86 90 QDomNodeList paragraphs = exampleDoc.elementsByTagName("p"); 87 91 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? 90 96 for (int p = 0; p < int(paragraphs.length()); ++p) { 91 97 description = this->extractTextFromParagraph(paragraphs.item(p)); … … 100 106 { 101 107 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); 103 110 } 104 111 -
trunk/demos/qtdemo/examplecontent.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/guide.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/guide.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/guidecircle.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/guidecircle.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/guideline.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/guideline.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/headingitem.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/headingitem.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/imageitem.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/imageitem.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/itemcircleanimation.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/itemcircleanimation.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 62 62 virtual ~ItemCircleAnimation(); 63 63 64 // over idden methods:64 // overridden methods: 65 65 QRectF boundingRect() const; 66 66 void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0); -
trunk/demos/qtdemo/letteritem.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/letteritem.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/main.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/mainwindow.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 267 267 if (Colors::showFps){ 268 268 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); 270 270 this->fpsLabel->setPos(Colors::stageStartX, 600 - QFontMetricsF(Colors::buttonFont()).height() - 5); 271 271 } 272 272 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); 275 277 this->companyLogo->setZValue(100); 276 278 this->qtLogo->setZValue(100); … … 377 379 QApplication::quit(); 378 380 } 379 else if (event->key() == Qt::Key_ 1){381 else if (event->key() == Qt::Key_F1){ 380 382 QString s(""); 381 383 s += "Rendering system: "; … … 387 389 s += "\nAdapt: "; 388 390 s += Colors::noAdapt ? "off" : "on"; 389 s += "\nAdaption occur ed: ";391 s += "\nAdaption occurred: "; 390 392 s += Colors::adapted ? "yes" : "no"; 391 393 s += "\nOpenGL version: "; … … 416 418 QMessageBox::information(0, QString("Current configuration"), s); 417 419 } 420 QGraphicsView::keyPressEvent(event); 418 421 } 419 422 -
trunk/demos/qtdemo/mainwindow.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 63 63 64 64 QGraphicsScene *scene; 65 QGraphicsWidget* mainSceneRoot; 66 65 67 bool loop; 66 68 … … 73 75 74 76 protected: 75 // Over idden methods:77 // Overridden methods: 76 78 void showEvent(QShowEvent *event); 77 79 void keyPressEvent(QKeyEvent *event); -
trunk/demos/qtdemo/menucontent.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/menucontent.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/menumanager.cpp
r696 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 153 153 this->launchExample(this->currentInfo); 154 154 break; 155 case LAUNCH_QML: 156 this->launchQmlExample(this->currentInfo); 157 break; 155 158 case DOCUMENTATION: 156 159 this->showDocInAssistant(this->currentInfo); … … 170 173 this->score->queueMovie(this->currentInfo + " -buttons -out", Score::NEW_ANIMATION_ONLY); 171 174 this->score->queueMovie("back -out", Score::ONLY_IF_VISIBLE); 175 if(qmlRoot) 176 qmlRoot->setProperty("show", QVariant(false)); 172 177 // book-keeping: 173 178 this->currentMenuCode = ROOT; … … 192 197 this->score->queueMovie(this->currentMenuButtons + " -out", Score::FROM_START, Score::LOCK_ITEMS); 193 198 this->score->queueMovie(this->currentInfo + " -out"); 199 if(qmlRoot) 200 qmlRoot->setProperty("show", QVariant(false)); 194 201 // book-keeping: 195 202 this->currentMenuCode = MENU1; … … 209 216 this->score->queueMovie(this->currentInfo + " -out", Score::NEW_ANIMATION_ONLY); 210 217 this->score->queueMovie(this->currentInfo + " -buttons -out", Score::NEW_ANIMATION_ONLY); 218 if(qmlRoot) 219 qmlRoot->setProperty("show", QVariant(false)); 211 220 // book-keeping: 212 221 this->currentMenuCode = MENU2; … … 243 252 this->score->queueMovie(this->currentInfo + " -out", Score::NEW_ANIMATION_ONLY); 244 253 this->score->queueMovie(this->currentInfo + " -buttons -out", Score::NEW_ANIMATION_ONLY); 254 if(qmlRoot) 255 qmlRoot->setProperty("show", QVariant(false)); 245 256 // book-keeping: 246 257 this->currentMenuCode = MENU1; … … 303 314 // was started to activate assistant and bring it to front: 304 315 QTextStream str(&this->assistantProcess); 305 str << "SetSource " << url << QLatin1Char('\ 0') << endl;316 str << "SetSource " << url << QLatin1Char('\n') << endl; 306 317 } 307 318 … … 344 355 } 345 356 357 void 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 391 void MenuManager::quitQML() 392 { 393 if(qmlRoot) 394 qmlRoot->setProperty("show", QVariant(false)); 395 } 396 346 397 void MenuManager::exampleFinished() 347 398 { … … 386 437 level2MenuNode = level2MenuNode.nextSibling(); 387 438 } 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 388 472 } 389 473 … … 393 477 if (this->info.contains(name)) 394 478 qWarning() << "__WARNING: MenuManager::readInfoAboutExample: Demo/example with name" 395 << name << "appears twi ze in the xml-file!__";479 << name << "appears twice in the xml-file!__"; 396 480 397 481 this->info[name]["filename"] = example.attribute("filename"); … … 400 484 this->info[name]["changedirectory"] = example.attribute("changedirectory"); 401 485 this->info[name]["image"] = example.attribute("image"); 486 this->info[name]["qml"] = example.attribute("qml"); 402 487 } 403 488 … … 434 519 dir.cd(fileName); 435 520 521 fileName = fileName.split("/").last(); 436 522 QFile unixFile(dir.path() + "/" + fileName); 437 523 if (unixFile.exists()) return unixFile.fileName(); … … 457 543 458 544 if (category == "demos") 459 return this->helpRootUrl + "demos-" + fileName + ".html";545 return this->helpRootUrl + "demos-" + fileName.replace("/", "-") + ".html"; 460 546 else 461 547 return this->helpRootUrl + dirName.replace("/", "-") + "-" + fileName + ".html"; … … 477 563 QString category = this->info[name]["category"]; 478 564 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(); 479 568 480 569 if (imageName.isEmpty()){ … … 496 585 QString name = el.attribute("name"); 497 586 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"); 499 588 500 589 Movie *menuButtonsIn = this->score->insertMovie(name + " -buttons"); … … 508 597 QString name = el.attribute("name"); 509 598 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"); 511 600 } 512 601 … … 514 603 { 515 604 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); 517 606 518 607 Movie *infoButtonsIn = this->score->insertMovie(name + " -buttons"); … … 521 610 if (el.attribute("executable") != "false") 522 611 createLowRightLeafButton("Launch", 405, LAUNCH, infoButtonsIn, infoButtonsOut, 0); 612 else if(el.attribute("qml") == "true") 613 createLowRightLeafButton("Display", 405, LAUNCH_QML, infoButtonsIn, infoButtonsOut, 0); 523 614 } 524 615 … … 549 640 // create normal menu button 550 641 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); 552 643 currentNode = currentNode.nextSibling(); 553 644 … … 649 740 Movie *movieIn, Movie *movieOut, Movie *movieShake, const QString &menuString) 650 741 { 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); 652 743 if (!menuString.isNull()) 653 744 button->setMenuString(menuString); … … 691 782 void MenuManager::createLowRightButton(const QString &label, BUTTON_TYPE type, Movie *movieIn, Movie *movieOut, Movie * /*movieShake*/) 692 783 { 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); 694 785 item->setRecursiveVisible(false); 695 786 item->setZValue(10); … … 718 809 void MenuManager::createLowRightLeafButton(const QString &label, int xOffset, BUTTON_TYPE type, Movie *movieIn, Movie *movieOut, Movie * /*movieShake*/) 719 810 { 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); 721 812 item->setRecursiveVisible(false); 722 813 item->setZValue(10); … … 834 925 float yOffset = 450.0f; 835 926 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); 837 928 this->upButton->prepare(); 838 929 this->upButton->setPos(xOffset, yOffset); 839 930 this->upButton->setState(TextButton::DISABLED); 840 931 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); 842 933 this->downButton->prepare(); 843 934 this->downButton->setPos(xOffset + 10 + this->downButton->sceneBoundingRect().width(), yOffset); -
trunk/demos/qtdemo/menumanager.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 46 46 #include <QtXml> 47 47 #include <QtHelp/QHelpEngineCore> 48 #ifndef QT_NO_DECLARATIVE 49 #include <QtDeclarative> 50 #endif 48 51 49 52 #include "score.h" … … 62 65 63 66 public: 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}; 65 68 66 69 // singleton pattern: … … 84 87 int currentMenuCode; 85 88 89 QObject *qmlRoot; 90 #ifndef QT_NO_DECLARATIVE 91 QDeclarativeEngine* declarativeEngine; 92 #endif 93 86 94 private slots: 87 95 void exampleFinished(); 88 96 void exampleError(QProcess::ProcessError error); 97 98 void quitQML(); 89 99 90 100 private: … … 101 111 void showDocInAssistant(const QString &docFile); 102 112 void launchExample(const QString &uniqueName); 113 void launchQmlExample(const QString &uniqueName); 103 114 104 115 void createMenu(const QDomElement &category, BUTTON_TYPE type); … … 129 140 TextButton *upButton; 130 141 TextButton *downButton; 142 131 143 }; 132 144 -
trunk/demos/qtdemo/qtdemo.pro
r695 r846 1 CONFIG += assistanthelp x11inc1 CONFIG += help x11inc 2 2 TARGET = qtdemo 3 3 DEMO_DESTDIR = $$QT_BUILD_TREE … … 12 12 DEFINES += QT_OPENGL_SUPPORT 13 13 QT += opengl 14 } 15 16 contains(QT_CONFIG, declarative) { 17 QT += declarative 14 18 } 15 19 … … 76 80 sources.path = $$[QT_INSTALL_DEMOS]/qtdemo 77 81 82 OTHER_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> 8 11 </RCC> -
trunk/demos/qtdemo/qtdemo.rc
r651 r846 19 19 VALUE "FileDescription", "Qt Examples and Demos" 20 20 VALUE "FileVersion", "1.0.0.0" 21 VALUE "LegalCopyright", "Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies)."21 VALUE "LegalCopyright", "Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)." 22 22 VALUE "InternalName", "qtdemo" 23 23 VALUE "OriginalFilename", "qtdemo.exe" -
trunk/demos/qtdemo/scanitem.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/scanitem.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/score.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/score.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/textbutton.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/demos/qtdemo/textbutton.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 62 62 virtual ~TextButton(); 63 63 64 // over idden methods:64 // overridden methods: 65 65 virtual QRectF boundingRect() const; 66 66 virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0){}; -
trunk/demos/qtdemo/xml/examples.xml
r769 r846 2 2 <categories name="Qt Examples and Demos"> 3 3 <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"/> 4 6 <example filename="affine" name="Affine Transformations" /> 5 <example filename="arthurplugin" name="Arthur Plugin" executable="false" />6 7 <example filename="composition" name="Composition Modes" /> 7 8 <example filename="gradients" name="Gradients" /> 8 9 <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"/> 9 22 <example filename="deform" name="Vector Deformation" /> 10 23 <example filename="books" name="Books" /> … … 12 25 <example filename="spreadsheet" name="Spreadsheet" /> 13 26 <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 23 29 </demos> 24 30 <category dirname="animation" name="Animation Framework"> … … 35 41 <example filename="runfunction" name="Run Function" executable="false"/> 36 42 <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" /> 37 50 </category> 38 51 <category dirname="designer" name="Qt Designer"> … … 116 129 <example filename="menus" name="Menus" /> 117 130 <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" /> 118 141 </category> 119 142 <category dirname="network" name="Networking">
Note:
See TracChangeset
for help on using the changeset viewer.