Changeset 846 for trunk/demos


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:
1 deleted
319 edited
238 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/demos/affine/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/affine/xform.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/affine/xform.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/arthurplugin/plugin.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/books/bookdelegate.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/books/bookdelegate.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/books/bookwindow.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)
     
    6565    model->setTable("books");
    6666
    67     // Remeber the indexes of the columns
     67    // Remember the indexes of the columns
    6868    authorIdx = model->fieldIndex("author");
    6969    genreIdx = model->fieldIndex("genre");
  • trunk/demos/books/bookwindow.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/books/initdb.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/books/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/boxes/basic.fsh

    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/boxes/basic.vsh

    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/boxes/dotted.fsh

    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/boxes/fresnel.fsh

    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/boxes/glass.fsh

    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/boxes/glbuffers.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/boxes/glbuffers.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/boxes/glextensions.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/boxes/glextensions.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/boxes/gltrianglemesh.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/boxes/granite.fsh

    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/boxes/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/boxes/marble.fsh

    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/boxes/qtbox.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/boxes/qtbox.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/boxes/reflection.fsh

    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/boxes/refraction.fsh

    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/boxes/roundedbox.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/boxes/roundedbox.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/boxes/scene.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/boxes/scene.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/boxes/trackball.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/boxes/trackball.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/boxes/wood.fsh

    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/browser/autosaver.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/browser/autosaver.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/browser/bookmarks.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/browser/bookmarks.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/browser/browserapplication.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/browser/browserapplication.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/browser/browsermainwindow.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)
     
    434434    QMenu *toolsMenu = menuBar()->addMenu(tr("&Tools"));
    435435    toolsMenu->addAction(tr("Web &Search"), this, SLOT(slotWebSearch()), QKeySequence(tr("Ctrl+K", "Web Search")));
    436 #ifndef Q_CC_MINGW
    437436    a = toolsMenu->addAction(tr("Enable Web &Inspector"), this, SLOT(slotToggleInspector(bool)));
    438437    a->setCheckable(true);
    439 #endif
    440438
    441439    QMenu *helpMenu = menuBar()->addMenu(tr("&Help"));
     
    673671            " new cookies are not stored, current cookies can't be accessed," \
    674672            " site icons wont be stored, session wont be saved, " \
    675             " and searches are not addded to the pop-up menu in the Google search box." \
     673            " and searches are not added to the pop-up menu in the Google search box." \
    676674            "  Until you close the window, you can still click the Back and Forward buttons" \
    677675            " to return to the webpages you have opened.").arg(title);
  • trunk/demos/browser/browsermainwindow.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/browser/chasewidget.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/browser/chasewidget.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/browser/cookiejar.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/browser/cookiejar.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/browser/data/browser.svg

    r651 r846  
    277277        <dc:rights>
    278278          <cc:Agent>
    279             <dc:title>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</dc:title>
     279            <dc:title>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</dc:title>
    280280          </cc:Agent>
    281281        </dc:rights>
  • trunk/demos/browser/downloadmanager.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)
     
    283283            .arg(timeRemaining)
    284284            .arg(timeRemainingString);
    285         info = QString(tr("%1 of %2 (%3/sec) %4"))
     285        info = tr("%1 of %2 (%3/sec) %4")
    286286            .arg(dataString(m_bytesReceived))
    287287            .arg(bytesTotal == 0 ? tr("?") : dataString(bytesTotal))
  • trunk/demos/browser/downloadmanager.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/browser/edittableview.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/browser/edittableview.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/browser/edittreeview.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/browser/edittreeview.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/browser/history.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/browser/history.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/browser/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/browser/modelmenu.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/browser/modelmenu.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/browser/networkaccessmanager.cpp

    r769 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/browser/networkaccessmanager.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/browser/searchlineedit.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/browser/searchlineedit.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/browser/settings.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)
     
    9090    QSettings settings;
    9191    settings.beginGroup(QLatin1String("MainWindow"));
    92     QString defaultHome = QLatin1String("http://qt.nokia.com");
     92    QString defaultHome = QLatin1String("http://doc.qt.nokia.com");
    9393    homeLineEdit->setText(settings.value(QLatin1String("home"), defaultHome).toString());
    9494    settings.endGroup();
  • trunk/demos/browser/settings.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/browser/squeezelabel.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/browser/squeezelabel.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/browser/tabwidget.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)
     
    6868            this, SLOT(contextMenuRequested(QPoint)));
    6969
    70     QString alt = QLatin1String("Alt+%1");
     70    QString ctrl = QLatin1String("Ctrl+%1");
    7171    for (int i = 1; i <= 10; ++i) {
    7272        int key = i;
    7373        if (key == 10)
    7474            key = 0;
    75         QShortcut *shortCut = new QShortcut(alt.arg(key), this);
     75        QShortcut *shortCut = new QShortcut(ctrl.arg(key), this);
    7676        m_tabShortcuts.append(shortCut);
    7777        connect(shortCut, SIGNAL(activated()), this, SLOT(selectTabAction()));
  • trunk/demos/browser/tabwidget.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/browser/toolbarsearch.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/browser/toolbarsearch.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/browser/urllineedit.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/browser/urllineedit.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/browser/webview.cpp

    r769 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)
     
    261261{
    262262    if (100 != m_progress) {
    263         qWarning() << "Recieved finished signal while progress is still:" << progress()
     263        qWarning() << "Received finished signal while progress is still:" << progress()
    264264                   << "Url:" << url();
    265265    }
  • trunk/demos/browser/webview.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/browser/xbel.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/browser/xbel.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/chip/chip.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/chip/chip.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/chip/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/chip/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)
  • trunk/demos/chip/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)
  • trunk/demos/chip/view.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/chip/view.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/composition/composition.cpp

    r769 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/composition/composition.h

    r769 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/composition/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/deform/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)
     
    5151    QApplication app(argc, argv);
    5252
    53     bool smallScreen = false;
    54     for (int i=0; i<argc; i++)
    55         if (QString(argv[i]) == "-small-screen")
    56             smallScreen = true;
     53    bool smallScreen = QApplication::arguments().contains("-small-screen");
    5754
    5855    PathDeformWidget deformWidget(0, smallScreen);
  • trunk/demos/deform/pathdeform.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/deform/pathdeform.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/demos.pro

    r769 r846  
    11TEMPLATE    = subdirs
     2
     3!contains(QT_CONFIG, no-gui) {
    24SUBDIRS     = \
    35            demos_shared \
     
    3941            demos_sub-attaq
    4042           
    41 contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles1):!contains(QT_CONFIG, opengles1cl):!contains(QT_CONFIG, opengles2):{
     43contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles1):!contains(QT_CONFIG, opengles2):{
    4244SUBDIRS += demos_boxes
    4345}
    4446
    4547mac*: SUBDIRS += demos_macmainwindow
    46 wince*|symbian|embedded|x11: SUBDIRS += embedded
     48wince*|symbian|embedded|x11: SUBDIRS += demos_embedded
    4749
    4850!contains(QT_EDITION, Console):!cross_compile:!embedded:!wince*:SUBDIRS += demos_arthurplugin
     
    5658contains(QT_CONFIG, phonon):!static:SUBDIRS += demos_mediaplayer
    5759contains(QT_CONFIG, webkit):contains(QT_CONFIG, svg):!symbian:SUBDIRS += demos_browser
    58 contains(QT_CONFIG, multimedia):SUBDIRS += demos_spectrum
     60contains(QT_CONFIG, declarative):SUBDIRS += demos_declarative
     61contains(QT_CONFIG, multimedia):!static:SUBDIRS += demos_spectrum
    5962
    6063# install
     
    6770demos_chip.subdir = chip
    6871demos_embeddeddialogs.subdir = embeddeddialogs
     72demos_embedded.subdir = embedded
     73# Because of fluidlauncher
     74demos_embedded.depends = demos_deform demos_pathstroke
    6975demos_shared.subdir = shared
    7076demos_deform.subdir = deform
     
    8490demos_qtdemo.subdir = qtdemo
    8591demos_mediaplayer.subdir = qmediaplayer
     92demos_declarative.subdir = declarative
    8693
    8794demos_browser.subdir = browser
     
    100107     demos_pathstroke.depends = demos_shared
    101108}
     109}
  • trunk/demos/embedded/anomaly/anomaly.pro

    r769 r846  
    2727    TARGET.UID3 = 0xA000CF71
    2828    include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
    29     HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h
    30     LIBS += -lesock -lcommdb -linsock # For IAP selection
    3129    TARGET.CAPABILITY = NetworkServices
    3230    TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
  • trunk/demos/embedded/anomaly/src/AddressBar.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)
     
    4545#include <QtGui>
    4646
    47 class LineEdit: public QLineEdit
    48 {
    49 public:
    50     LineEdit(QWidget *parent = 0): QLineEdit(parent) {}
    51 
    52     void paintEvent(QPaintEvent *event) {
    53         QLineEdit::paintEvent(event);
    54         if (text().isEmpty()) {
    55             QPainter p(this);
    56             int flags = Qt::AlignLeft | Qt::AlignVCenter;
    57             p.setPen(palette().color(QPalette::Disabled, QPalette::Text));
    58             p.drawText(rect().adjusted(10, 0, 0, 0), flags, "Enter address or search terms");
    59             p.end();
    60         }
    61     }
    62 };
    63 
    6447AddressBar::AddressBar(QWidget *parent)
    6548    : QWidget(parent)
    6649{
    67     m_lineEdit = new LineEdit(parent);
     50    m_lineEdit = new QLineEdit(parent);
     51    m_lineEdit->setPlaceholderText("Enter address or search terms");
    6852    connect(m_lineEdit, SIGNAL(returnPressed()), SLOT(processAddress()));
    6953    m_toolButton = new QToolButton(parent);
  • trunk/demos/embedded/anomaly/src/AddressBar.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/embedded/anomaly/src/BookmarksView.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)
     
    5656    m_iconView->addItem("www.google.com");
    5757    m_iconView->addItem("qt.nokia.com/doc/4.5");
    58     m_iconView->addItem("news.bbc.co.uk/text_only.stm");
     58    m_iconView->addItem("news.bbc.co.uk/2/mobile/default.stm");
    5959    m_iconView->addItem("mobile.wikipedia.org");
    6060    m_iconView->addItem("qt.nokia.com");
  • trunk/demos/embedded/anomaly/src/BookmarksView.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/embedded/anomaly/src/BrowserView.cpp

    r769 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)
     
    5252#include "ZoomStrip.h"
    5353
    54 #if defined (Q_OS_SYMBIAN)
    55 #include "sym_iap_util.h"
    56 #endif
    57 
    5854BrowserView::BrowserView(QWidget *parent)
    5955    : QWidget(parent)
     
    7167    m_zoomLevels << 100;
    7268    m_zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;
     69
     70    QNetworkConfigurationManager manager;
     71    if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) {
     72        // Get saved network configuration
     73        QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
     74        settings.beginGroup(QLatin1String("QtNetwork"));
     75        const QString id =
     76            settings.value(QLatin1String("DefaultNetworkConfiguration")).toString();
     77        settings.endGroup();
     78
     79        // If the saved network configuration is not currently discovered use the system
     80        // default
     81        QNetworkConfiguration config = manager.configurationFromIdentifier(id);
     82        if ((config.state() & QNetworkConfiguration::Discovered) !=
     83            QNetworkConfiguration::Discovered) {
     84            config = manager.defaultConfiguration();
     85        }
     86
     87        m_webView->page()->networkAccessManager()->setConfiguration(config);
     88    }
    7389
    7490    QTimer::singleShot(0, this, SLOT(initialize()));
     
    101117    m_webView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    102118    m_webView->setFocus();
    103 #ifdef Q_OS_SYMBIAN
    104     QTimer::singleShot(0, this, SLOT(setDefaultIap()));
    105 #endif
    106119}
    107120
     
    174187    m_zoomStrip->move(width() - zw, (height() - zh) / 2);
    175188}
    176 #ifdef Q_OS_SYMBIAN
    177 void BrowserView::setDefaultIap()
    178 {
    179     qt_SetDefaultIap();
    180     m_webView->load(QUrl("http://news.bbc.co.uk/text_only.stm"));
    181 }
    182 #endif
    183189
    184190void BrowserView::navigate(const QUrl &url)
  • trunk/demos/embedded/anomaly/src/BrowserView.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)
     
    6464    void zoomIn();
    6565    void zoomOut();
    66 #ifdef Q_OS_SYMBIAN
    67     void setDefaultIap();
    68 #endif
    6966
    7067private slots:
  • trunk/demos/embedded/anomaly/src/BrowserWindow.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/embedded/anomaly/src/BrowserWindow.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/embedded/anomaly/src/ControlStrip.cpp

    r769 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/embedded/anomaly/src/ControlStrip.h

    r769 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/embedded/anomaly/src/HomeView.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/embedded/anomaly/src/HomeView.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/embedded/anomaly/src/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/embedded/anomaly/src/TitleBar.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/embedded/anomaly/src/TitleBar.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/embedded/anomaly/src/ZoomStrip.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/embedded/anomaly/src/ZoomStrip.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/embedded/anomaly/src/flickcharm.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/embedded/anomaly/src/flickcharm.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/embedded/anomaly/src/webview.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/embedded/anomaly/src/webview.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/embedded/desktopservices/contenttab.cpp

    r769 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)
     
    126126{
    127127    Q_UNUSED(item);
    128     QMessageBox::warning(this, tr("Operation Failed"), tr("Unkown error!"), QMessageBox::Close);
     128    QMessageBox::warning(this, tr("Operation Failed"), tr("Unknown error!"), QMessageBox::Close);
    129129}
    130130
  • trunk/demos/embedded/desktopservices/contenttab.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/embedded/desktopservices/desktopservices.pro

    r561 r846  
    2525
    2626wince*{
    27     music.path = "\My Documents\My Music"
    28     image.path = "\My Documents\My Pictures"
     27    music.path = "\\My Documents\\My Music"
     28    image.path = "\\My Documents\\My Pictures"
    2929    DEPLOYMENT += music image
    3030}
  • trunk/demos/embedded/desktopservices/desktopwidget.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)
     
    7474    // Links
    7575    LinkTab* othersTab = new LinkTab(tabWidget);;
    76     // Given icon file will be overriden by LinkTab
     76    // Given icon file will be overridden by LinkTab
    7777    othersTab->init(QDesktopServices::PicturesLocation, "", "");
    7878    tabWidget->addTab(othersTab, tr("Links"));
  • trunk/demos/embedded/desktopservices/desktopwidget.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/embedded/desktopservices/linktab.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/embedded/desktopservices/linktab.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/embedded/desktopservices/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/embedded/digiflip/digiflip.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/embedded/embedded.pro

    r561 r846  
    55    SUBDIRS += embeddedsvgviewer \
    66               desktopservices
     7    fluidlauncher.subdir = fluidlauncher
     8    fluidlauncher.depends = styledemo desktopservices raycasting flickable digiflip lightmaps flightinfo
    79    !vxworks:!qnx:SUBDIRS += fluidlauncher
    810}
     
    1820}
    1921
     22contains(QT_CONFIG, declarative) {
     23    # Qml demos require DEPLOYMENT support. Therefore, only symbian.
     24    symbian:SUBDIRS += qmlcalculator qmlclocks qmldialcontrol qmleasing qmlflickr qmlphotoviewer qmltwitter
     25}
     26
    2027# install
    2128sources.files = README *.pro
  • trunk/demos/embedded/embeddedsvgviewer/embeddedsvgviewer.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/embedded/embeddedsvgviewer/embeddedsvgviewer.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/embedded/embeddedsvgviewer/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/embedded/flickable/flickable.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/embedded/flickable/flickable.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/embedded/flickable/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/embedded/flightinfo/flightinfo.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)
     
    4444#include <QtNetwork>
    4545
    46 #if defined (Q_OS_SYMBIAN)
    47 #include "sym_iap_util.h"
    48 #endif
    49 
    5046#include "ui_form.h"
    5147
     
    10197    QDate m_searchDate;
    10298    QPixmap m_map;
     99    QNetworkAccessManager m_manager;
     100    QList<QNetworkReply *> mapReplies;
    103101
    104102public:
     
    116114
    117115        setWindowTitle("Flight Info");
    118         QTimer::singleShot(0, this, SLOT(delayedInit()));
    119116
    120117        // Rendered from the public-domain vectorized aircraft
     
    128125        connect(searchYesterdayAction, SIGNAL(triggered()), SLOT(yesterday()));
    129126        connect(randomAction, SIGNAL(triggered()), SLOT(randomFlight()));
     127        connect(&m_manager, SIGNAL(finished(QNetworkReply*)),
     128                this, SLOT(handleNetworkData(QNetworkReply*)));
    130129#if defined(Q_OS_SYMBIAN)
    131130        menuBar()->addAction(searchTodayAction);
     
    141140
    142141private slots:
    143     void delayedInit() {
    144 #if defined(Q_OS_SYMBIAN)
    145         qt_SetDefaultIap();
    146 #endif
    147     }
    148 
    149142
    150143    void handleNetworkData(QNetworkReply *networkReply) {
    151144        if (!networkReply->error()) {
    152             // Assume UTF-8 encoded
    153             QByteArray data = networkReply->readAll();
    154             QString xml = QString::fromUtf8(data);
    155             digest(xml);
     145            if (!mapReplies.contains(networkReply)) {
     146                // Assume UTF-8 encoded
     147                QByteArray data = networkReply->readAll();
     148                QString xml = QString::fromUtf8(data);
     149                digest(xml);
     150            } else {
     151                mapReplies.removeOne(networkReply);
     152                m_map.loadFromData(networkReply->readAll());
     153                update();
     154            }
    156155        }
    157156        networkReply->deleteLater();
    158         networkReply->manager()->deleteLater();
    159     }
    160 
    161     void handleMapData(QNetworkReply *networkReply) {
    162         if (!networkReply->error()) {
    163             m_map.loadFromData(networkReply->readAll());
    164             update();
    165         }
    166         networkReply->deleteLater();
    167         networkReply->manager()->deleteLater();
    168157    }
    169158
     
    186175        ui.flightStatus->hide();
    187176        ui.flightName->setText("Enter flight number");
     177        ui.flightEdit->setFocus();
     178#ifdef QT_KEYPAD_NAVIGATION
     179        ui.flightEdit->setEditFocus(true);
     180#endif
    188181        m_map = QPixmap();
    189182        update();
     
    225218        }
    226219
    227         QNetworkAccessManager *manager = new QNetworkAccessManager(this);
    228         connect(manager, SIGNAL(finished(QNetworkReply*)),
    229                 this, SLOT(handleNetworkData(QNetworkReply*)));
    230         manager->get(QNetworkRequest(m_url));
     220        m_manager.get(QNetworkRequest(m_url));
    231221    }
    232222
     
    249239            QString airport = regex.cap(1);
    250240            m_url.addEncodedQueryItem("dpap", QUrl::toPercentEncoding(airport));
    251             QNetworkAccessManager *manager = new QNetworkAccessManager(this);
    252             connect(manager, SIGNAL(finished(QNetworkReply*)),
    253                     this, SLOT(handleNetworkData(QNetworkReply*)));
    254             manager->get(QNetworkRequest(m_url));
     241            m_manager.get(QNetworkRequest(m_url));
    255242            return;
    256243        }
     
    288275                if (xml.name() == "img" && inFlightMap) {
    289276                    QString src = xml.attributes().value("src").toString();
    290                     src.prepend("http://mobile.flightview.com");
     277                    src.prepend("http://mobile.flightview.com/");
    291278                    QUrl url = QUrl::fromPercentEncoding(src.toAscii());
    292                     QNetworkAccessManager *manager = new QNetworkAccessManager(this);
    293                     connect(manager, SIGNAL(finished(QNetworkReply*)),
    294                             this, SLOT(handleMapData(QNetworkReply*)));
    295                     manager->get(QNetworkRequest(url));
     279                    mapReplies.append(m_manager.get(QNetworkRequest(url)));
    296280                }
    297281            }
  • trunk/demos/embedded/flightinfo/flightinfo.pro

    r769 r846  
    99    TARGET.UID3 = 0xA000CF74
    1010    include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
    11     HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h
    12     LIBS += -lesock -lcommdb -linsock # For IAP selection
    1311    TARGET.CAPABILITY = NetworkServices
    1412}
  • trunk/demos/embedded/fluidlauncher/config_s60/config.xml

    r769 r846  
    2222    <example filename="qmediaplayer" name="Media Player" image="screenshots/mediaplayer.png" args="-small-screen"/>
    2323    <example filename="spectrum" name="Spectrum Analyzer" image="screenshots/spectrum.png" args="-small-screen"/>
     24    <example filename="qmlcalculator" name="Qml Calculator" image="screenshots/qmlcalculator.png"/>
     25    <example filename="qmlclocks" name="Qml Clocks" image="screenshots/qmlclocks.png"/>
     26    <example filename="qmldialcontrol" name="Qml Dial Control" image="screenshots/qmldialcontrol.png"/>
     27    <example filename="qmleasing" name="Qml Easing Curves" image="screenshots/qmleasing.png"/>
     28    <example filename="qmlflickr" name="Qml flickr" image="screenshots/qmlflickr.jpg"/>
     29    <example filename="qmlphotoviewer" name="Qml Photo Viewer" image="screenshots/qmlphotoviewer.jpg"/>
     30    <example filename="qmltwitter" name="Qml twitter" image="screenshots/qmltwitter.jpg"/>
    2431  </demos>
    2532  <slideshow timeout="60000" interval="10000">
  • trunk/demos/embedded/fluidlauncher/demoapplication.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/embedded/fluidlauncher/demoapplication.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/embedded/fluidlauncher/fluidlauncher.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)
     
    155155                DemoApplication* newDemo = new DemoApplication(
    156156                        filename.toString(),
    157                         name.isEmpty() ? "Unamed Demo" : name.toString(),
     157                        name.isEmpty() ? "Unnamed Demo" : name.toString(),
    158158                        image.toString(),
    159159                        args.toString().split(" "));
  • trunk/demos/embedded/fluidlauncher/fluidlauncher.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/embedded/fluidlauncher/fluidlauncher.pro

    r769 r846  
    33DEPENDPATH += .
    44INCLUDEPATH += .
     5VERSION = $$QT_VERSION
    56
    67# Input
     
    5859symbian {
    5960    load(data_caging_paths)
     61    include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
     62    RSS_RULES = # Clear RSS_RULES, otherwise fluidlauncher will get put into QtDemos folder
    6063
    6164    TARGET.UID3 = 0xA000A641
    62     ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg
     65
     66    defineReplace(regResourceDir) {
     67        symbian-abld|symbian-sbsv2 {
     68            return($${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/$$basename(1))
     69        } else {
     70            return($${QT_BUILD_TREE}/$$1)
     71        }
     72    }
     73
     74    defineReplace(appResourceDir) {
     75        symbian-abld|symbian-sbsv2 {
     76            return($${EPOCROOT}$${HW_ZDIR}$${APP_RESOURCE_DIR}/$$basename(1))
     77        } else {
     78            return($${QT_BUILD_TREE}/$$1)
     79        }
     80    }
    6381
    6482    executables.sources = \
    65         styledemo.exe \
    66         deform.exe \
    67         pathstroke.exe \
    68         wiggly.exe \
    69         qftp.exe \
    70         saxbookmarks.exe \
    71         desktopservices.exe \
    72         fridgemagnets.exe \
    73         softkeys.exe \
    74         raycasting.exe \
    75         flickable.exe \
    76         digiflip.exe \
    77         lightmaps.exe \
    78         flightinfo.exe
     83        $$QT_BUILD_TREE/demos/embedded/styledemo/styledemo.exe \
     84        $$QT_BUILD_TREE/demos/deform/deform.exe \
     85        $$QT_BUILD_TREE/demos/pathstroke/pathstroke.exe \
     86        $$QT_BUILD_TREE/examples/widgets/wiggly/wiggly.exe \
     87        $$QT_BUILD_TREE/examples/network/qftp/qftp.exe \
     88        $$QT_BUILD_TREE/examples/xml/saxbookmarks/saxbookmarks.exe \
     89        $$QT_BUILD_TREE/demos/embedded/desktopservices/desktopservices.exe \
     90        $$QT_BUILD_TREE/examples/draganddrop/fridgemagnets/fridgemagnets.exe \
     91        $$QT_BUILD_TREE/examples/widgets/softkeys/softkeys.exe \
     92        $$QT_BUILD_TREE/demos/embedded/raycasting/raycasting.exe \
     93        $$QT_BUILD_TREE/demos/embedded/flickable/flickable.exe \
     94        $$QT_BUILD_TREE/demos/embedded/digiflip/digiflip.exe \
     95        $$QT_BUILD_TREE/demos/embedded/lightmaps/lightmaps.exe \
     96        $$QT_BUILD_TREE/demos/embedded/flightinfo/flightinfo.exe
    7997
    8098    executables.path = /sys/bin
    8199
    82100    reg_resource.sources = \
    83         $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/styledemo_reg.rsc \
    84         $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/deform_reg.rsc \
    85         $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/pathstroke_reg.rsc \
    86         $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/wiggly_reg.rsc \
    87         $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/qftp_reg.rsc\
    88         $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/saxbookmarks_reg.rsc \
    89         $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/desktopservices_reg.rsc \
    90         $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/fridgemagnets_reg.rsc \
    91         $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/softkeys_reg.rsc \
    92         $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/raycasting_reg.rsc \
    93         $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/flickable_reg.rsc \
    94         $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/digiflip_reg.rsc \
    95         $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/lightmaps_reg.rsc \
    96         $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/flightinfo_reg.rsc
     101        $$regResourceDir(demos/embedded/styledemo/styledemo_reg.rsc) \
     102        $$regResourceDir(demos/deform/deform_reg.rsc) \
     103        $$regResourceDir(demos/pathstroke/pathstroke_reg.rsc) \
     104        $$regResourceDir(examples/widgets/wiggly/wiggly_reg.rsc) \
     105        $$regResourceDir(examples/network/qftp/qftp_reg.rsc)\
     106        $$regResourceDir(examples/xml/saxbookmarks/saxbookmarks_reg.rsc) \
     107        $$regResourceDir(demos/embedded/desktopservices/desktopservices_reg.rsc) \
     108        $$regResourceDir(examples/draganddrop/fridgemagnets/fridgemagnets_reg.rsc) \
     109        $$regResourceDir(examples/widgets/softkeys/softkeys_reg.rsc) \
     110        $$regResourceDir(demos/embedded/raycasting/raycasting_reg.rsc) \
     111        $$regResourceDir(demos/embedded/flickable/flickable_reg.rsc) \
     112        $$regResourceDir(demos/embedded/digiflip/digiflip_reg.rsc) \
     113        $$regResourceDir(demos/embedded/lightmaps/lightmaps_reg.rsc) \
     114        $$regResourceDir(demos/embedded/flightinfo/flightinfo_reg.rsc)
    97115
    98116    contains(QT_CONFIG, phonon) {
    99         reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/qmediaplayer_reg.rsc
     117        reg_resource.sources += $$regResourceDir(demos/qmediaplayer/qmediaplayer_reg.rsc)
    100118    }
    101119
    102120    contains(QT_CONFIG, multimedia) {
    103         reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/spectrum_reg.rsc
     121        reg_resource.sources += $$regResourceDir(demos/spectrum/app/spectrum_reg.rsc)
    104122    }
    105123
     
    108126
    109127    resource.sources = \
    110         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/styledemo.rsc \
    111         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/deform.rsc \
    112         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/pathstroke.rsc \
    113         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/wiggly.rsc \
    114         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/qftp.rsc\
    115         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/saxbookmarks.rsc \
    116         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/desktopservices.rsc \
    117         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/fridgemagnets.rsc \
    118         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/softkeys.rsc \
    119         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/raycasting.rsc \
    120         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/flickable.rsc \
    121         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/digiflip.rsc \
    122         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/lightmaps.rsc \
    123         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/flightinfo.rsc
     128        $$appResourceDir(demos/embedded/styledemo/styledemo.rsc) \
     129        $$appResourceDir(demos/deform/deform.rsc) \
     130        $$appResourceDir(demos/pathstroke/pathstroke.rsc) \
     131        $$appResourceDir(examples/widgets/wiggly/wiggly.rsc) \
     132        $$appResourceDir(examples/network/qftp/qftp.rsc)\
     133        $$appResourceDir(examples/xml/saxbookmarks/saxbookmarks.rsc) \
     134        $$appResourceDir(demos/embedded/desktopservices/desktopservices.rsc) \
     135        $$appResourceDir(examples/draganddrop/fridgemagnets/fridgemagnets.rsc) \
     136        $$appResourceDir(examples/widgets/softkeys/softkeys.rsc) \
     137        $$appResourceDir(demos/embedded/raycasting/raycasting.rsc) \
     138        $$appResourceDir(demos/embedded/flickable/flickable.rsc) \
     139        $$appResourceDir(demos/embedded/digiflip/digiflip.rsc) \
     140        $$appResourceDir(demos/embedded/lightmaps/lightmaps.rsc) \
     141        $$appResourceDir(demos/embedded/flightinfo/flightinfo.rsc)
    124142
    125143
     
    127145
    128146    mifs.sources = \
    129         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/fluidlauncher.mif \
    130         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/styledemo.mif \
    131         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/deform.mif \
    132         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/pathstroke.mif \
    133         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/wiggly.mif \
    134         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/qftp.mif \
    135         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/saxbookmarks.mif \
    136         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/desktopservices.mif \
    137         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/fridgemagnets.mif \
    138         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/softkeys.mif \
    139         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/raycasting.mif \
    140         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/flickable.mif \
    141         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/digiflip.mif \
    142         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/lightmaps.mif \
    143         $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/flightinfo.mif
     147        $$appResourceDir(demos/embedded/fluidlauncher/fluidlauncher.mif) \
     148        $$appResourceDir(demos/embedded/styledemo/styledemo.mif) \
     149        $$appResourceDir(demos/deform/deform.mif) \
     150        $$appResourceDir(demos/pathstroke/pathstroke.mif) \
     151        $$appResourceDir(examples/widgets/wiggly/wiggly.mif) \
     152        $$appResourceDir(examples/network/qftp/qftp.mif) \
     153        $$appResourceDir(examples/xml/saxbookmarks/saxbookmarks.mif) \
     154        $$appResourceDir(demos/embedded/desktopservices/desktopservices.mif) \
     155        $$appResourceDir(examples/draganddrop/fridgemagnets/fridgemagnets.mif) \
     156        $$appResourceDir(examples/widgets/softkeys/softkeys.mif) \
     157        $$appResourceDir(demos/embedded/raycasting/raycasting.mif) \
     158        $$appResourceDir(demos/embedded/flickable/flickable.mif) \
     159        $$appResourceDir(demos/embedded/digiflip/digiflip.mif) \
     160        $$appResourceDir(demos/embedded/lightmaps/lightmaps.mif) \
     161        $$appResourceDir(demos/embedded/flightinfo/flightinfo.mif)
    144162    mifs.path = $$APP_RESOURCE_DIR
    145163
    146164    contains(QT_CONFIG, svg) {
    147165        executables.sources += \
    148             embeddedsvgviewer.exe \
    149             weatherinfo.exe
     166            $$QT_BUILD_TREE/demos/embedded/embeddedsvgviewer/embeddedsvgviewer.exe \
     167            $$QT_BUILD_TREE/demos/embedded/weatherinfo/weatherinfo.exe
    150168
    151169        reg_resource.sources += \
    152             $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/embeddedsvgviewer_reg.rsc \
    153             $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/weatherinfo_reg.rsc
     170            $$regResourceDir(demos/embedded/embeddedsvgviewer/embeddedsvgviewer_reg.rsc) \
     171            $$regResourceDir(demos/embedded/weatherinfo/weatherinfo_reg.rsc)
    154172
    155173        resource.sources += \
    156             $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/embeddedsvgviewer.rsc \
    157             $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/weatherinfo.rsc
    158 
    159         mifs.sources += \
    160             $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/embeddedsvgviewer.mif \
    161             $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/weatherinfo.mif
     174            $$appResourceDir(demos/embedded/embeddedsvgviewer/embeddedsvgviewer.rsc) \
     175            $$appResourceDir(demos/embedded/weatherinfo/weatherinfo.rsc)
     176
     177        mifs.sources += \
     178            $$appResourceDir(demos/embedded/embeddedsvgviewer/embeddedsvgviewer.mif) \
     179            $$appResourceDir(demos/embedded/weatherinfo/weatherinfo.mif)
    162180
    163181    }
    164182    contains(QT_CONFIG, webkit) {
    165         executables.sources += anomaly.exe
    166         reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/anomaly_reg.rsc
    167         resource.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/anomaly.rsc
    168         mifs.sources += \
    169             $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/anomaly.mif
     183        executables.sources += $$QT_BUILD_TREE/demos/embedded/anomaly/anomaly.exe
     184        reg_resource.sources += $$regResourceDir(demos/embedded/anomaly/anomaly_reg.rsc)
     185        resource.sources += $$appResourceDir(demos/embedded/anomaly/anomaly.rsc)
     186        mifs.sources += \
     187            $$appResourceDir(demos/embedded/anomaly/anomaly.mif)
    170188
    171189        isEmpty(QT_LIBINFIX) {
     
    178196
    179197    contains(QT_CONFIG, phonon) {
    180         executables.sources += qmediaplayer.exe
    181         resource.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/qmediaplayer.rsc
    182         mifs.sources += \
    183             $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/qmediaplayer.mif
     198        executables.sources += $$QT_BUILD_TREE/demos/qmediaplayer/qmediaplayer.exe
     199        resource.sources += $$appResourceDir(demos/qmediaplayer/qmediaplayer.rsc)
     200        mifs.sources += \
     201            $$appResourceDir(demos/qmediaplayer/qmediaplayer.mif)
    184202    }
    185203
    186204    contains(QT_CONFIG, multimedia) {
    187         executables.sources += spectrum.exe fftreal.dll
    188         resource.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/spectrum.rsc
    189         mifs.sources += \
    190             $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/spectrum.mif
     205        executables.sources += $$QT_BUILD_TREE/demos/spectrum/app/spectrum.exe
     206        executables.sources += $$QT_BUILD_TREE/demos/spectrum/3rdparty/fftreal/fftreal.dll
     207        resource.sources += $$appResourceDir(demos/spectrum/app/spectrum.rsc)
     208        mifs.sources += \
     209            $$appResourceDir(demos/spectrum/app/spectrum.mif)
    191210    }
    192211
    193212    contains(QT_CONFIG, script) {
    194         executables.sources += context2d.exe
    195         reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/context2d_reg.rsc
    196         resource.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/context2d.rsc
    197         mifs.sources += \
    198             $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/context2d.mif
     213        executables.sources += $$QT_BUILD_TREE/examples/script/context2d/context2d.exe
     214        reg_resource.sources += $$regResourceDir(examples/script/context2d/context2d_reg.rsc)
     215        resource.sources += $$appResourceDir(examples/script/context2d/context2d.rsc)
     216        mifs.sources += \
     217            $$appResourceDir(examples/script/context2d/context2d.mif)
     218    }
     219
     220    qmldemos = qmlcalculator qmlclocks qmldialcontrol qmleasing qmlflickr qmlphotoviewer qmltwitter
     221    contains(QT_CONFIG, declarative) {
     222        for(qmldemo, qmldemos) {
     223            executables.sources += $$QT_BUILD_TREE/demos/embedded/$${qmldemo}/$${qmldemo}.exe
     224            reg_resource.sources += $$regResourceDir(demos/embedded/$${qmldemo}/$${qmldemo}_reg.rsc)
     225            resource.sources += $$appResourceDir(demos/embedded/$${qmldemo}/$${qmldemo}.rsc)
     226            mifs.sources += $$appResourceDir(demos/embedded/$${qmldemo}/$${qmldemo}.mif)
     227        }
    199228    }
    200229
     
    227256        mifs desktopservices_music desktopservices_images fluidbackup
    228257
     258    contains(QT_CONFIG, declarative):for(qmldemo, qmldemos):include($$QT_BUILD_TREE/demos/embedded/$${qmldemo}/deployment.pri)
     259
    229260    DEPLOYMENT.installer_header = 0xA000D7CD
    230261
  • trunk/demos/embedded/fluidlauncher/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/embedded/fluidlauncher/pictureflow.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)
     
    604604  img = img.scaled(w, h, Qt::IgnoreAspectRatio, mode);
    605605
    606   // slightly larger, to accomodate for the reflection
     606  // slightly larger, to accommodate for the reflection
    607607  int hs = h * 2;
    608608  int hofs = h / 3;
  • trunk/demos/embedded/fluidlauncher/pictureflow.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/embedded/fluidlauncher/slideshow.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/embedded/fluidlauncher/slideshow.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/embedded/lightmaps/lightmaps.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)
     
    4343#include <QtGui>
    4444#include <QtNetwork>
    45 
    46 #if defined (Q_OS_SYMBIAN)
    47 #include "sym_iap_util.h"
    48 #endif
    4945
    5046#include <math.h>
     
    491487private:
    492488    LightMaps *map;
     489    QNetworkSession *networkSession;
    493490
    494491public:
     
    527524#endif
    528525
    529         QTimer::singleShot(0, this, SLOT(delayedInit()));
     526        QNetworkConfigurationManager manager;
     527        if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) {
     528            // Get saved network configuration
     529            QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
     530            settings.beginGroup(QLatin1String("QtNetwork"));
     531            const QString id =
     532                settings.value(QLatin1String("DefaultNetworkConfiguration")).toString();
     533            settings.endGroup();
     534
     535            // If the saved network configuration is not currently discovered use the system
     536            // default
     537            QNetworkConfiguration config = manager.configurationFromIdentifier(id);
     538            if ((config.state() & QNetworkConfiguration::Discovered) !=
     539                QNetworkConfiguration::Discovered) {
     540                config = manager.defaultConfiguration();
     541            }
     542
     543            networkSession = new QNetworkSession(config, this);
     544            connect(networkSession, SIGNAL(opened()), this, SLOT(sessionOpened()));
     545
     546            networkSession->open();
     547        } else {
     548            networkSession = 0;
     549        }
    530550    }
    531551
    532552private slots:
    533553
    534     void delayedInit() {
    535 #if defined(Q_OS_SYMBIAN)
    536         qt_SetDefaultIap();
    537 #endif
     554    void sessionOpened() {
     555        // Save the used configuration
     556        QNetworkConfiguration config = networkSession->configuration();
     557        QString id;
     558        if (config.type() == QNetworkConfiguration::UserChoice) {
     559            id = networkSession->sessionProperty(
     560                    QLatin1String("UserChoiceConfiguration")).toString();
     561        } else {
     562            id = config.identifier();
     563        }
     564
     565        QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
     566        settings.beginGroup(QLatin1String("QtNetwork"));
     567        settings.setValue(QLatin1String("DefaultNetworkConfiguration"), id);
     568        settings.endGroup();
    538569    }
    539570
  • trunk/demos/embedded/lightmaps/lightmaps.pro

    r769 r846  
    66    TARGET.UID3 = 0xA000CF75
    77    include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
    8     HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h
    9     LIBS += -lesock -lcommdb -linsock # For IAP selection
    108    TARGET.CAPABILITY = NetworkServices
    119    TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
  • trunk/demos/embedded/raycasting/raycasting.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)
     
    143143
    144144        for (int ray = 0; ray < bufw; ++ray, u += du, v += dv) {
    145             // everytime this ray advances 'u' units in x direction,
     145            // every time this ray advances 'u' units in x direction,
    146146            // it also advanced 'v' units in y direction
    147147            qreal uu = (u < 0) ? -u : u;
  • trunk/demos/embedded/styledemo/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/embedded/styledemo/stylewidget.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/embedded/styledemo/stylewidget.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/embedded/weatherinfo/weatherinfo.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)
     
    4444#include <QtNetwork>
    4545#include <QtSvg>
    46 
    47 #if defined (Q_OS_SYMBIAN)
    48 #include "sym_iap_util.h"
    49 #endif
    5046
    5147class WeatherInfo: public QMainWindow
     
    6864    QTimeLine m_timeLine;
    6965    QHash<QString, QString> m_icons;
     66    QNetworkAccessManager m_manager;
    7067
    7168public:
     
    9996        setContextMenuPolicy(Qt::ActionsContextMenu);
    10097
     98        connect(&m_manager, SIGNAL(finished(QNetworkReply*)),
     99                this, SLOT(handleNetworkData(QNetworkReply*)));
     100
    101101        QTimer::singleShot(0, this, SLOT(delayedInit()));
    102102    }
     
    104104private slots:
    105105    void delayedInit() {
    106 #if defined(Q_OS_SYMBIAN)
    107         qt_SetDefaultIap();
    108 #endif
    109106        request("Oslo");
    110107    }
     
    123120            digest(QString::fromUtf8(networkReply->readAll()));
    124121        networkReply->deleteLater();
    125         networkReply->manager()->deleteLater();
    126122    }
    127123
     
    186182        url.addEncodedQueryItem("weather", QUrl::toPercentEncoding(location));
    187183
    188         QNetworkAccessManager *manager = new QNetworkAccessManager(this);
    189         connect(manager, SIGNAL(finished(QNetworkReply*)),
    190                 this, SLOT(handleNetworkData(QNetworkReply*)));
    191         manager->get(QNetworkRequest(url));
     184        m_manager.get(QNetworkRequest(url));
    192185
    193186        city = QString();
  • trunk/demos/embedded/weatherinfo/weatherinfo.pro

    r769 r846  
    88    TARGET.UID3 = 0xA000CF77
    99    include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
    10     HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h
    11     LIBS += -lesock -lcommdb -linsock # For IAP selection
    1210    TARGET.CAPABILITY = NetworkServices
    1311}
  • trunk/demos/embeddeddialogs/customproxy.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/embeddeddialogs/customproxy.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/embeddeddialogs/embeddeddialog.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/embeddeddialogs/embeddeddialog.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/embeddeddialogs/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/gradients/gradients.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/gradients/gradients.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/gradients/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/interview/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/interview/model.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)
     
    4646Model::Model(int rows, int columns, QObject *parent)
    4747    : QAbstractItemModel(parent),
     48      services(QPixmap(":/images/services.png")),
    4849      rc(rows), cc(columns),
    4950      tree(new QVector<Node>(rows, Node(0)))
     
    106107QVariant Model::headerData(int section, Qt::Orientation orientation, int role) const
    107108{
    108     static QIcon services(QPixmap(":/images/services.png"));
    109109    if (role == Qt::DisplayRole)
    110110        return QString::number(section);
  • trunk/demos/interview/model.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)
     
    4545#include <QAbstractItemModel>
    4646#include <QFileIconProvider>
     47#include <QIcon>
    4748#include <QVector>
    4849
     
    8182    int row(Node *node) const;
    8283
     84    QIcon services;
    8385    int rc, cc;
    8486    QVector<Node> *tree;
  • trunk/demos/macmainwindow/macmainwindow.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/macmainwindow/macmainwindow.mm

    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/macmainwindow/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/mainwindow/colorswatch.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/mainwindow/colorswatch.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/mainwindow/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/mainwindow/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)
     
    8282    ;
    8383
     84Q_DECLARE_METATYPE(QDockWidget::DockWidgetFeatures)
     85
    8486MainWindow::MainWindow(const QMap<QString, QSize> &customSizeHints,
    8587                        QWidget *parent, Qt::WindowFlags flags)
     
    275277void MainWindow::setupDockWidgets(const QMap<QString, QSize> &customSizeHints)
    276278{
     279    qRegisterMetaType<QDockWidget::DockWidgetFeatures>();
     280
    277281    mapper = new QSignalMapper(this);
    278282    connect(mapper, SIGNAL(mapped(int)), this, SLOT(setCorner(int)));
     
    330334            swatch->setTitleBarWidget(titlebar);
    331335            connect(swatch, SIGNAL(topLevelChanged(bool)), titlebar, SLOT(updateMask()));
    332             connect(swatch, SIGNAL(featuresChanged(QDockWidget::DockWidgetFeatures)), titlebar, SLOT(updateMask()));
     336            connect(swatch, SIGNAL(featuresChanged(QDockWidget::DockWidgetFeatures)), titlebar, SLOT(updateMask()), Qt::QueuedConnection);
    333337
    334338#ifdef Q_WS_QWS
  • trunk/demos/mainwindow/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)
  • trunk/demos/mainwindow/toolbar.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/mainwindow/toolbar.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/pathstroke/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)
     
    4949    QApplication app(argc, argv);
    5050
    51     bool smallScreen = false;
    52     for (int i=0; i<argc; i++)
    53         if (QString(argv[i]) == "-small-screen")
    54             smallScreen = true;
     51    bool smallScreen = QApplication::arguments().contains("-small-screen");
    5552
    5653    PathStrokeWidget pathStrokeWidget(smallScreen);
  • trunk/demos/pathstroke/pathstroke.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/pathstroke/pathstroke.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/qmediaplayer/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)
     
    4343#include "mediaplayer.h"
    4444
     45const qreal DefaultVolume = -1.0;
     46
    4547int main (int argc, char *argv[])
    4648{
     
    5153    app.setQuitOnLastWindowClosed(true);
    5254
    53     bool hasSmallScreen =
     55    QString fileName;
     56    qreal volume = DefaultVolume;
     57    bool smallScreen = false;
    5458#ifdef Q_OS_SYMBIAN
    55         /* On Symbian, we always want fullscreen. One reason is that it's not
    56          * possible to launch any demos from the fluidlauncher due to a
    57          * limitation in the emulator. */
    58         true
    59 #else
    60         false
     59    smallScreen = true;
    6160#endif
    62     ;
    6361
    64     QString fileString;
    65     const QStringList args(app.arguments());
    66     /* We have a minor problem here, we accept two arguments, both are
    67      * optional:
    68      * - A file name
    69      * - the option "-small-screen", so let's try to cope with that.
    70      */
    71     for (int i = 0; i < args.count(); ++i) {
    72         const QString &at = args.at(i);
    73 
    74         if (at == QLatin1String("-small-screen"))
    75             hasSmallScreen = true;
    76         else if (i > 0) // We don't want the app name.
    77             fileString = at;
     62    QStringList args(app.arguments());
     63    args.removeFirst(); // remove name of executable
     64    while (!args.empty()) {
     65        const QString &arg = args.first();
     66        if (QLatin1String("-small-screen") == arg || QLatin1String("--small-screen") == arg) {
     67            smallScreen = true;
     68        } else if (QLatin1String("-volume") == arg || QLatin1String("--volume") == arg) {
     69            if (!args.empty()) {
     70                args.removeFirst();
     71                volume = qMax(qMin(args.first().toFloat(), float(1.0)), float(0.0));
     72            }
     73        } else if (fileName.isNull()) {
     74            fileName = arg;
     75        }
     76        args.removeFirst();
    7877    }
    7978
    80     MediaPlayer player(fileString, hasSmallScreen);
     79    MediaPlayer player;
     80    player.setSmallScreen(smallScreen);
     81    if (DefaultVolume != volume)
     82        player.setVolume(volume);
     83    if (!fileName.isNull())
     84        player.setFile(fileName);
    8185
    82     if (hasSmallScreen)
     86    if (smallScreen)
    8387        player.showMaximized();
    8488    else
  • trunk/demos/qmediaplayer/mediaplayer.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)
     
    4747#include "ui_settings.h"
    4848
     49#ifdef Q_OS_SYMBIAN
     50#include <cdbcols.h>
     51#include <cdblen.h>
     52#include <commdb.h>
     53#endif
    4954
    5055MediaVideoWidget::MediaVideoWidget(MediaPlayer *player, QWidget *parent) :
     
    153158
    154159
    155 MediaPlayer::MediaPlayer(const QString &filePath,
    156                          const bool hasSmallScreen) :
     160MediaPlayer::MediaPlayer() :
    157161        playButton(0), nextEffect(0), settingsDialog(0), ui(0),
    158162            m_AudioOutput(Phonon::VideoCategory),
    159             m_videoWidget(new MediaVideoWidget(this)),
    160             m_hasSmallScreen(hasSmallScreen)
     163            m_videoWidget(new MediaVideoWidget(this))
    161164{
    162165    setWindowTitle(tr("Media Player"));
     
    272275    QAction *openFileAction = fileMenu->addAction(tr("Open &File..."));
    273276    QAction *openUrlAction = fileMenu->addAction(tr("Open &Location..."));
     277#ifdef Q_OS_SYMBIAN
     278    QAction *selectIAPAction = fileMenu->addAction(tr("Select &IAP..."));
     279    connect(selectIAPAction, SIGNAL(triggered(bool)), this, SLOT(selectIAP()));
     280#endif
    274281    QAction *const openLinkAction = fileMenu->addAction(tr("Open &RAM File..."));
    275282
     
    347354    Phonon::createPath(&m_MediaObject, m_videoWidget);
    348355
    349     if (!filePath.isEmpty())
    350         setFile(filePath);
    351356    resize(minimumSizeHint());
    352357}
     
    359364        QRect videoHintRect = QRect(QPoint(0, 0), m_videoWindow.sizeHint());
    360365        QRect newVideoRect = QApplication::desktop()->screenGeometry().intersected(videoHintRect);
    361         if (!m_hasSmallScreen) {
     366        if (!m_smallScreen) {
    362367            if (m_MediaObject.hasVideo()) {
    363368                // Flush event que so that sizeHint takes the
     
    467472}
    468473
     474void MediaPlayer::setVolume(qreal volume)
     475{
     476    m_AudioOutput.setVolume(volume);
     477}
     478
     479void MediaPlayer::setSmallScreen(bool smallScreen)
     480{
     481    m_smallScreen = smallScreen;
     482}
     483
    469484void MediaPlayer::effectChanged()
    470485{
     
    590605
    591606        if (effectDialog.result() != QDialog::Accepted) {
    592             //we need to restore the paramaters values
     607            //we need to restore the parameters values
    593608            int currentIndex = 0;
    594609            foreach(Phonon::EffectParameter param, nextEffect->parameters()) {
     
    686701    // popping up dialogs. We neither want to tamper with the state if the
    687702    // user has paused.
    688     if (m_hasSmallScreen && m_MediaObject.hasVideo()) {
     703    if (m_smallScreen && m_MediaObject.hasVideo()) {
    689704        if (Phonon::PlayingState == m_MediaObject.state()) {
    690705            m_MediaObject.pause();
     
    717732void MediaPlayer::bufferStatus(int percent)
    718733{
    719     if (percent == 0 || percent == 100)
     734    if (percent == 100)
    720735        progressLabel->setText(QString());
    721736    else {
     
    944959    m_fullScreenAction->setEnabled(bHasVideo);
    945960}
     961
     962#ifdef Q_OS_SYMBIAN
     963void MediaPlayer::selectIAP()
     964{
     965    TRAPD(err, selectIAPL());
     966    if (KErrNone != err)
     967        QMessageBox::warning(this, "Phonon Mediaplayer", "Error selecting IAP", QMessageBox::Close);
     968}
     969
     970void MediaPlayer::selectIAPL()
     971{
     972    QVariant currentIAPValue = m_MediaObject.property("InternetAccessPointName");
     973    QString currentIAPString = currentIAPValue.toString();
     974    bool ok = false;
     975    CCommsDatabase *commsDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
     976    CleanupStack::PushL(commsDb);
     977    commsDb->ShowHiddenRecords();
     978    CCommsDbTableView* view = commsDb->OpenTableLC(TPtrC(IAP));
     979    QStringList items;
     980    TInt currentIAP = 0;
     981    for (TInt l = view->GotoFirstRecord(), i = 0; l != KErrNotFound; l = view->GotoNextRecord(), i++) {
     982       TBuf<KCommsDbSvrMaxColumnNameLength> iapName;
     983       view->ReadTextL(TPtrC(COMMDB_NAME), iapName);
     984       QString iapString = QString::fromUtf16(iapName.Ptr(), iapName.Length());
     985       items << iapString;
     986       if (iapString == currentIAPString)
     987           currentIAP = i;
     988    }
     989    currentIAPString = QInputDialog::getItem(this, tr("Select Access Point"), tr("Select Access Point"), items, currentIAP, false, &ok);
     990    if (ok)
     991        m_MediaObject.setProperty("InternetAccessPointName", currentIAPString);
     992    CleanupStack::PopAndDestroy(2); //commsDB, view
     993}
     994#endif
  • trunk/demos/qmediaplayer/mediaplayer.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)
     
    105105    Q_OBJECT
    106106public:
    107     MediaPlayer(const QString &,
    108                 const bool hasSmallScreen);
     107    MediaPlayer();
    109108
    110109    void dragEnterEvent(QDragEnterEvent *e);
     
    116115    void initVideoWindow();
    117116    void initSettingsDialog();
     117    void setVolume(qreal volume);
     118    void setSmallScreen(bool smallScreen);
    118119
    119120public slots:
     
    141142    void bufferStatus(int percent);
    142143    void openUrl();
     144#ifdef Q_OS_SYMBIAN
     145    void selectIAP();
     146#endif
    143147    void openRamFile();
    144148    void configureEffect();
     
    147151private:
    148152    bool playPauseForDialog();
     153#ifdef Q_OS_SYMBIAN
     154    void selectIAPL();
     155#endif
    149156
    150157    QIcon playIcon;
     
    172179    MediaVideoWidget *m_videoWidget;
    173180    Phonon::Path m_audioOutputPath;
    174     const bool m_hasSmallScreen;
     181    bool m_smallScreen;
    175182};
    176183
  • trunk/demos/qmediaplayer/qmediaplayer.pro

    r561 r846  
    3434    include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
    3535
     36        LIBS += -lCommDb
     37
    3638    TARGET.CAPABILITY="NetworkServices"
    3739}
  • 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">
  • trunk/demos/shared/arthurstyle.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/shared/arthurstyle.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/shared/arthurwidgets.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/shared/arthurwidgets.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/shared/hoverpoints.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/shared/hoverpoints.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/shared/shared.pri

    r561 r846  
    77contains(CONFIG, debug_and_release_target) {   
    88    CONFIG(debug, debug|release) {
    9         LIBS+=-L$$SHARED_FOLDER/debug
     9        QMAKE_LIBDIR += $$SHARED_FOLDER/debug
    1010    } else {
    11         LIBS+=-L$$SHARED_FOLDER/release
     11        QMAKE_LIBDIR += $$SHARED_FOLDER/release
    1212    }
    1313} else {
    14     LIBS += -L$$SHARED_FOLDER
     14    QMAKE_LIBDIR += $$SHARED_FOLDER
    1515}
    1616
  • trunk/demos/spectrum/3rdparty/fftreal/fftreal.pro

    r769 r846  
     1include(../../spectrum.pri)
     2
     3static: error(This library cannot be built for static linkage)
     4
    15TEMPLATE = lib
    26TARGET   = fftreal
     
    3034symbian {
    3135    # Provide unique ID for the generated binary, required by Symbian OS
    32     TARGET.UID3 = 0xA000E3FB
     36    TARGET.UID3 = 0xA000E403
    3337    TARGET.CAPABILITY = UserEnvironment
     38}
     39
     40macx {
     41    CONFIG += lib_bundle
    3442} else {
    35     macx {
    36         CONFIG += lib_bundle
    37     } else {
    38         DESTDIR = ../../bin
    39     }
    40 }
     43    !symbian: DESTDIR = ../..$${spectrum_build_dir}
     44}
    4145
    4246# Install
  • trunk/demos/spectrum/3rdparty/fftreal/fftreal_wrapper.cpp

    r769 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** Contact: Nokia Corporation (qt-info@nokia.com)
    55**
  • trunk/demos/spectrum/3rdparty/fftreal/fftreal_wrapper.h

    r769 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** Contact: Nokia Corporation (qt-info@nokia.com)
    55**
  • trunk/demos/spectrum/app/app.pro

    r769 r846  
    11include(../spectrum.pri)
     2
     3static: error(This application cannot be statically linked to the fftreal library)
    24
    35TEMPLATE = app
    46
    57TARGET = spectrum
    6 unix: !macx: !symbian: TARGET = spectrum.bin
    78
    89QT       += multimedia
     
    4950
    5051    # Provide unique ID for the generated binary, required by Symbian OS
    51     TARGET.UID3 = 0xA000E3FA
     52    TARGET.UID3 = 0xA000E402
    5253}
    5354
     
    5859        # Must explicitly add the .dll suffix to ensure dynamic linkage
    5960        LIBS += -lfftreal.dll
     61        QMAKE_LIBDIR += $${fftreal_dir}
    6062    } else {
    6163        macx {
     
    6466            LIBS += -framework fftreal
    6567        } else {
    66             # Link to dynamic library which is written to ../bin
    67             LIBS += -L../bin
     68            LIBS += -L..$${spectrum_build_dir}
    6869            LIBS += -lfftreal
    6970        }
     
    8687    !contains(DEFINES, DISABLE_FFT) {
    8788        # Include FFTReal DLL in the SIS file
    88         fftreal.sources = $${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/fftreal.dll
     89        fftreal.sources = ../fftreal.dll
    8990        fftreal.path = !:/sys/bin
    9091        DEPLOYMENT += fftreal
    9192    }
    9293} else {
     94        DESTDIR = ..$${spectrum_build_dir}
    9395    macx {
    94         # Specify directory in which to create spectrum.app bundle
    95         DESTDIR = ..
    96 
    9796        !contains(DEFINES, DISABLE_FFT) {
    9897            # Relocate fftreal.framework into spectrum.app bundle
     
    110109        }
    111110    } else {
    112         # Specify directory in which to create spectrum application
    113         DESTDIR = ../bin
    114 
    115         unix: !symbian {
    116             # On unices other than Mac OSX, we copy a shell script into the bin directory.
    117             # This script takes care of correctly setting the LD_LIBRARY_PATH so that
    118             # the dynamic library can be located.
    119             copy_launch_script.target = copy_launch_script
    120             copy_launch_script.commands = \
    121                 install -m 0555 $$QT_SOURCE_TREE/demos/spectrum/app/spectrum.sh ../bin/spectrum
    122             QMAKE_EXTRA_TARGETS += copy_launch_script
    123             POST_TARGETDEPS += copy_launch_script
     111        linux-g++*: {
     112            # Provide relative path from application to fftreal library
     113            QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN
    124114        }
    125115    }
  • trunk/demos/spectrum/app/engine.cpp

    r769 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)
     
    8686    ,   m_generateTone(false)
    8787    ,   m_file(0)
     88    ,   m_analysisFile(0)
    8889    ,   m_availableAudioInputDevices
    8990            (QAudioDeviceInfo::availableDevices(QAudio::AudioInput))
     
    9798    ,   m_audioOutput(0)
    9899    ,   m_playPosition(0)
     100    ,   m_bufferPosition(0)
     101    ,   m_bufferLength(0)
    99102    ,   m_dataLength(0)
     103    ,   m_levelBufferLength(0)
    100104    ,   m_rmsLevel(0.0)
    101105    ,   m_peakLevel(0.0)
    102     ,   m_spectrumLengthBytes(0)
     106    ,   m_spectrumBufferLength(0)
    103107    ,   m_spectrumAnalyser()
    104108    ,   m_spectrumPosition(0)
     
    106110{
    107111    qRegisterMetaType<FrequencySpectrum>("FrequencySpectrum");
     112    qRegisterMetaType<WindowFunction>("WindowFunction");
    108113    CHECKED_CONNECT(&m_spectrumAnalyser,
    109114                    SIGNAL(spectrumChanged(FrequencySpectrum)),
     
    133138bool Engine::loadFile(const QString &fileName)
    134139{
     140    reset();
    135141    bool result = false;
    136     m_generateTone = false;
    137 
     142    Q_ASSERT(!m_generateTone);
     143    Q_ASSERT(!m_file);
    138144    Q_ASSERT(!fileName.isEmpty());
    139     Q_ASSERT(!m_file);
    140     m_file = new QFile(fileName, this);
    141     m_file->setFileName(fileName);
    142     Q_ASSERT(m_file->exists());
    143     if (m_file->open(QFile::ReadOnly)) {
    144         m_wavFile.readHeader(*m_file);
    145         if (isPCMS16LE(m_wavFile.format())) {
     145    m_file = new WavFile(this);
     146    if (m_file->open(fileName)) {
     147        if (isPCMS16LE(m_file->fileFormat())) {
    146148            result = initialize();
    147149        } else {
    148150            emit errorMessage(tr("Audio format not supported"),
    149                               formatToString(m_wavFile.format()));
     151                              formatToString(m_file->fileFormat()));
    150152        }
    151153    } else {
    152154        emit errorMessage(tr("Could not open file"), fileName);
    153155    }
    154 
    155     delete m_file;
    156     m_file = 0;
    157 
     156    if (result) {
     157        m_analysisFile = new WavFile(this);
     158        m_analysisFile->open(fileName);
     159    }
    158160    return result;
    159161}
     
    161163bool Engine::generateTone(const Tone &tone)
    162164{
     165    reset();
     166    Q_ASSERT(!m_generateTone);
    163167    Q_ASSERT(!m_file);
    164168    m_generateTone = true;
     
    173177bool Engine::generateSweptTone(qreal amplitude)
    174178{
     179    Q_ASSERT(!m_generateTone);
    175180    Q_ASSERT(!m_file);
    176181    m_generateTone = true;
     
    186191bool Engine::initializeRecord()
    187192{
     193    reset();
    188194    ENGINE_DEBUG << "Engine::initializeRecord";
     195    Q_ASSERT(!m_generateTone);
    189196    Q_ASSERT(!m_file);
    190197    m_generateTone = false;
     
    193200}
    194201
    195 qint64 Engine::bufferDuration() const
    196 {
    197     return BufferDurationUs;
    198 }
    199 
    200 qint64 Engine::dataDuration() const
    201 {
    202     qint64 result = 0;
    203     if (QAudioFormat() != m_format)
    204         result = audioDuration(m_format, m_dataLength);
    205     return result;
    206 }
    207 
    208 qint64 Engine::audioBufferLength() const
    209 {
    210     qint64 length = 0;
    211     if (QAudio::ActiveState == m_state || QAudio::IdleState == m_state) {
    212         Q_ASSERT(QAudioFormat() != m_format);
    213         switch (m_mode) {
    214         case QAudio::AudioInput:
    215             length = m_audioInput->bufferSize();
    216             break;
    217         case QAudio::AudioOutput:
    218             length = m_audioOutput->bufferSize();
    219             break;
    220         }
    221     }
    222     return length;
     202qint64 Engine::bufferLength() const
     203{
     204    return m_file ? m_file->size() : m_bufferLength;
    223205}
    224206
     
    253235            m_count = 0;
    254236            m_dataLength = 0;
    255             emit dataDurationChanged(0);
     237            emit dataLengthChanged(0);
    256238            m_audioInputIODevice = m_audioInput->start();
    257239            CHECKED_CONNECT(m_audioInputIODevice, SIGNAL(readyRead()),
     
    276258            m_spectrumAnalyser.cancelCalculation();
    277259            spectrumChanged(0, 0, FrequencySpectrum());
    278 
    279260            setPlayPosition(0, true);
    280261            stopRecording();
     
    285266                            this, SLOT(audioNotify()));
    286267            m_count = 0;
    287             m_audioOutputIODevice.close();
    288             m_audioOutputIODevice.setBuffer(&m_buffer);
    289             m_audioOutputIODevice.open(QIODevice::ReadOnly);
    290             m_audioOutput->start(&m_audioOutputIODevice);
     268            if (m_file) {
     269                m_file->seek(0);
     270                m_bufferPosition = 0;
     271                m_dataLength = 0;
     272                m_audioOutput->start(m_file);
     273            } else {
     274                m_audioOutputIODevice.close();
     275                m_audioOutputIODevice.setBuffer(&m_buffer);
     276                m_audioOutputIODevice.open(QIODevice::ReadOnly);
     277                m_audioOutput->start(&m_audioOutputIODevice);
     278            }
    291279        }
    292280    }
     
    333321    switch (m_mode) {
    334322    case QAudio::AudioInput: {
    335             const qint64 recordPosition =
    336                     qMin(BufferDurationUs, m_audioInput->processedUSecs());
     323            const qint64 recordPosition = qMin(m_bufferLength, audioLength(m_format, m_audioInput->processedUSecs()));
    337324            setRecordPosition(recordPosition);
    338 
    339             // Calculate level of most recently captured data
    340             qint64 levelLength = audioLength(m_format, LevelWindowUs);
    341             levelLength = qMin(m_dataLength, levelLength);
    342             const qint64 levelPosition = m_dataLength - levelLength;
    343             calculateLevel(levelPosition, levelLength);
    344 
    345             // Calculate spectrum of most recently captured data
    346             if (m_dataLength >= m_spectrumLengthBytes) {
    347                 const qint64 spectrumPosition = m_dataLength - m_spectrumLengthBytes;
     325            const qint64 levelPosition = m_dataLength - m_levelBufferLength;
     326            if (levelPosition >= 0)
     327                calculateLevel(levelPosition, m_levelBufferLength);
     328            if (m_dataLength >= m_spectrumBufferLength) {
     329                const qint64 spectrumPosition = m_dataLength - m_spectrumBufferLength;
    348330                calculateSpectrum(spectrumPosition);
    349331            }
     332            emit bufferChanged(0, m_dataLength, m_buffer);
    350333        }
    351334        break;
    352335    case QAudio::AudioOutput: {
    353             const qint64 playPosition =
    354                     qMin(dataDuration(), m_audioOutput->processedUSecs());
    355             setPlayPosition(playPosition);
    356 
    357             qint64 analysisPosition = audioLength(m_format, playPosition);
    358 
    359             // Calculate level of data starting at current playback position
    360             const qint64 levelLength = audioLength(m_format, LevelWindowUs);
    361             if (analysisPosition + levelLength < m_dataLength)
    362                 calculateLevel(analysisPosition, levelLength);
    363 
    364             if (analysisPosition + m_spectrumLengthBytes < m_dataLength)
    365                 calculateSpectrum(analysisPosition);
    366 
    367             if (dataDuration() == playPosition)
    368                 stopPlayback();
     336            const qint64 playPosition = audioLength(m_format, m_audioOutput->processedUSecs());
     337            setPlayPosition(qMin(bufferLength(), playPosition));
     338            const qint64 levelPosition = playPosition - m_levelBufferLength;
     339            const qint64 spectrumPosition = playPosition - m_spectrumBufferLength;
     340            if (m_file) {
     341                if (levelPosition > m_bufferPosition ||
     342                    spectrumPosition > m_bufferPosition ||
     343                    qMax(m_levelBufferLength, m_spectrumBufferLength) > m_dataLength) {
     344                    m_bufferPosition = 0;
     345                    m_dataLength = 0;
     346                    // Data needs to be read into m_buffer in order to be analysed
     347                    const qint64 readPos = qMax(qint64(0), qMin(levelPosition, spectrumPosition));
     348                    const qint64 readEnd = qMin(m_analysisFile->size(), qMax(levelPosition + m_levelBufferLength, spectrumPosition + m_spectrumBufferLength));
     349                    const qint64 readLen = readEnd - readPos + audioLength(m_format, WaveformWindowDuration);
     350                    qDebug() << "Engine::audioNotify [1]"
     351                             << "analysisFileSize" << m_analysisFile->size()
     352                             << "readPos" << readPos
     353                             << "readLen" << readLen;
     354                    if (m_analysisFile->seek(readPos + m_analysisFile->headerLength())) {
     355                        m_buffer.resize(readLen);
     356                        m_bufferPosition = readPos;
     357                        m_dataLength = m_analysisFile->read(m_buffer.data(), readLen);
     358                        qDebug() << "Engine::audioNotify [2]" << "bufferPosition" << m_bufferPosition << "dataLength" << m_dataLength;
     359                    } else {
     360                        qDebug() << "Engine::audioNotify [2]" << "file seek error";
     361                    }
     362                    emit bufferChanged(m_bufferPosition, m_dataLength, m_buffer);
     363                }
     364            } else {
     365                if (playPosition >= m_dataLength)
     366                    stopPlayback();
     367            }
     368            if (levelPosition >= 0 && levelPosition + m_levelBufferLength < m_bufferPosition + m_dataLength)
     369                calculateLevel(levelPosition, m_levelBufferLength);
     370            if (spectrumPosition >= 0 && spectrumPosition + m_spectrumBufferLength < m_bufferPosition + m_dataLength)
     371                calculateSpectrum(spectrumPosition);
    369372        }
    370373        break;
     
    377380                 << "to" << state;
    378381
    379     if (QAudio::StoppedState == state) {
    380         // Check error
    381         QAudio::Error error = QAudio::NoError;
    382         switch (m_mode) {
    383         case QAudio::AudioInput:
    384             error = m_audioInput->error();
    385             break;
    386         case QAudio::AudioOutput:
    387             error = m_audioOutput->error();
    388             break;
    389         }
    390         if (QAudio::NoError != error) {
    391             reset();
    392             return;
    393         }
    394     }
    395     setState(state);
     382    if (QAudio::IdleState == state && m_file && m_file->pos() == m_file->size()) {
     383        stopPlayback();
     384    } else {
     385        if (QAudio::StoppedState == state) {
     386            // Check error
     387            QAudio::Error error = QAudio::NoError;
     388            switch (m_mode) {
     389            case QAudio::AudioInput:
     390                error = m_audioInput->error();
     391                break;
     392            case QAudio::AudioOutput:
     393                error = m_audioOutput->error();
     394                break;
     395            }
     396            if (QAudio::NoError != error) {
     397                reset();
     398                return;
     399            }
     400        }
     401        setState(state);
     402    }
    396403}
    397404
    398405void Engine::audioDataReady()
    399406{
     407    Q_ASSERT(0 == m_bufferPosition);
    400408    const qint64 bytesReady = m_audioInput->bytesReady();
    401409    const qint64 bytesSpace = m_buffer.size() - m_dataLength;
     
    408416    if (bytesRead) {
    409417        m_dataLength += bytesRead;
    410 
    411         const qint64 duration = audioDuration(m_format, m_dataLength);
    412         emit dataDurationChanged(duration);
     418        emit dataLengthChanged(dataLength());
    413419    }
    414420
     
    420426{
    421427    ENGINE_DEBUG << "Engine::spectrumChanged" << "pos" << m_spectrumPosition;
    422     const qint64 positionUs = audioDuration(m_format, m_spectrumPosition);
    423     const qint64 lengthUs = audioDuration(m_format, m_spectrumLengthBytes);
    424     emit spectrumChanged(positionUs, lengthUs, spectrum);
     428    emit spectrumChanged(m_spectrumPosition, m_spectrumBufferLength, spectrum);
    425429}
    426430
     
    430434//-----------------------------------------------------------------------------
    431435
    432 void Engine::reset()
    433 {
    434     stopRecording();
    435     stopPlayback();
    436     setState(QAudio::AudioInput, QAudio::StoppedState);
    437     setFormat(QAudioFormat());
     436void Engine::resetAudioDevices()
     437{
    438438    delete m_audioInput;
    439439    m_audioInput = 0;
     
    443443    m_audioOutput = 0;
    444444    setPlayPosition(0);
     445    m_spectrumPosition = 0;
     446    setLevel(0.0, 0.0, 0);
     447}
     448
     449void Engine::reset()
     450{
     451    stopRecording();
     452    stopPlayback();
     453    setState(QAudio::AudioInput, QAudio::StoppedState);
     454    setFormat(QAudioFormat());
     455    m_generateTone = false;
     456    delete m_file;
     457    m_file = 0;
     458    delete m_analysisFile;
     459    m_analysisFile = 0;
    445460    m_buffer.clear();
     461    m_bufferPosition = 0;
     462    m_bufferLength = 0;
    446463    m_dataLength = 0;
    447     m_spectrumPosition = 0;
    448     emit dataDurationChanged(0);
    449     setLevel(0.0, 0.0, 0);
     464    emit dataLengthChanged(0);
     465    resetAudioDevices();
    450466}
    451467
     
    454470    bool result = false;
    455471
    456     reset();
     472    QAudioFormat format = m_format;
    457473
    458474    if (selectFormat()) {
    459         const qint64 bufferLength = audioLength(m_format, BufferDurationUs);
    460         m_buffer.resize(bufferLength);
    461         m_buffer.fill(0);
    462         emit bufferDurationChanged(BufferDurationUs);
    463 
    464         if (m_generateTone) {
    465             if (0 == m_tone.endFreq) {
    466                 const qreal nyquist = nyquistFrequency(m_format);
    467                 m_tone.endFreq = qMin(qreal(SpectrumHighFreq), nyquist);
     475        if (m_format != format) {
     476            resetAudioDevices();
     477            if (m_file) {
     478                emit bufferLengthChanged(bufferLength());
     479                emit dataLengthChanged(dataLength());
     480                emit bufferChanged(0, 0, m_buffer);
     481                setRecordPosition(bufferLength());
     482                result = true;
     483            } else {
     484                m_bufferLength = audioLength(m_format, BufferDurationUs);
     485                m_buffer.resize(m_bufferLength);
     486                m_buffer.fill(0);
     487                emit bufferLengthChanged(bufferLength());
     488                if (m_generateTone) {
     489                    if (0 == m_tone.endFreq) {
     490                        const qreal nyquist = nyquistFrequency(m_format);
     491                        m_tone.endFreq = qMin(qreal(SpectrumHighFreq), nyquist);
     492                    }
     493                    // Call function defined in utils.h, at global scope
     494                    ::generateTone(m_tone, m_format, m_buffer);
     495                    m_dataLength = m_bufferLength;
     496                    emit dataLengthChanged(dataLength());
     497                    emit bufferChanged(0, m_dataLength, m_buffer);
     498                    setRecordPosition(m_bufferLength);
     499                    result = true;
     500                } else {
     501                    emit bufferChanged(0, 0, m_buffer);
     502                    m_audioInput = new QAudioInput(m_audioInputDevice, m_format, this);
     503                    m_audioInput->setNotifyInterval(NotifyIntervalMs);
     504                    result = true;
     505                }
    468506            }
    469 
    470             // Call function defined in utils.h, at global scope
    471             ::generateTone(m_tone, m_format, m_buffer);
    472             m_dataLength = m_buffer.size();
    473             emit dataDurationChanged(bufferDuration());
    474             setRecordPosition(bufferDuration());
    475             result = true;
    476         } else if (m_file) {
    477             const qint64 length = m_wavFile.readData(*m_file, m_buffer, m_format);
    478             if (length) {
    479                 m_dataLength = length;
    480                 emit dataDurationChanged(dataDuration());
    481                 setRecordPosition(dataDuration());
    482                 result = true;
    483             }
    484         } else {
    485             m_audioInput = new QAudioInput(m_audioInputDevice, m_format, this);
    486             m_audioInput->setNotifyInterval(NotifyIntervalMs);
    487             result = true;
    488         }
    489 
    490         m_audioOutput = new QAudioOutput(m_audioOutputDevice, m_format, this);
    491         m_audioOutput->setNotifyInterval(NotifyIntervalMs);
    492         m_spectrumLengthBytes = SpectrumLengthSamples *
    493                                 (m_format.sampleSize() / 8) * m_format.channels();
     507            m_audioOutput = new QAudioOutput(m_audioOutputDevice, m_format, this);
     508            m_audioOutput->setNotifyInterval(NotifyIntervalMs);
     509        }
    494510    } else {
    495511        if (m_file)
     
    502518    }
    503519
     520    ENGINE_DEBUG << "Engine::initialize" << "m_bufferLength" << m_bufferLength;
     521    ENGINE_DEBUG << "Engine::initialize" << "m_dataLength" << m_dataLength;
    504522    ENGINE_DEBUG << "Engine::initialize" << "format" << m_format;
    505523
     
    511529    bool foundSupportedFormat = false;
    512530
    513     if (m_file) {
    514         // Header is read from the WAV file; just need to check whether
    515         // it is supported by the audio output device
    516         QAudioFormat format = m_wavFile.format();
    517         if (m_audioOutputDevice.isFormatSupported(m_wavFile.format())) {
    518             setFormat(m_wavFile.format());
     531    if (m_file || QAudioFormat() != m_format) {
     532        QAudioFormat format = m_format;
     533        if (m_file)
     534            // Header is read from the WAV file; just need to check whether
     535            // it is supported by the audio output device
     536            format = m_file->fileFormat();
     537        if (m_audioOutputDevice.isFormatSupported(format)) {
     538            setFormat(format);
    519539            foundSupportedFormat = true;
    520         } else {
    521             // Try flipping mono <-> stereo
    522             const int channels = (format.channels() == 1) ? 2 : 1;
    523             format.setChannels(channels);
    524             if (m_audioOutputDevice.isFormatSupported(format)) {
    525                 setFormat(format);
    526                 foundSupportedFormat = true;
    527             }
    528540        }
    529541    } else {
     
    649661    Q_UNUSED(length)
    650662#else
    651     Q_ASSERT(position + length <= m_dataLength);
     663    Q_ASSERT(position + length <= m_bufferPosition + m_dataLength);
    652664
    653665    qreal peakLevel = 0.0;
    654666
    655667    qreal sum = 0.0;
    656     const char *ptr = m_buffer.constData() + position;
     668    const char *ptr = m_buffer.constData() + position - m_bufferPosition;
    657669    const char *const end = ptr + length;
    658670    while (ptr < end) {
     
    680692    Q_UNUSED(position)
    681693#else
    682     Q_ASSERT(position + m_spectrumLengthBytes <= m_dataLength);
    683     Q_ASSERT(0 == m_spectrumLengthBytes % 2); // constraint of FFT algorithm
     694    Q_ASSERT(position + m_spectrumBufferLength <= m_bufferPosition + m_dataLength);
     695    Q_ASSERT(0 == m_spectrumBufferLength % 2); // constraint of FFT algorithm
    684696
    685697    // QThread::currentThread is marked 'for internal use only', but
    686698    // we're only using it for debug output here, so it's probably OK :)
    687699    ENGINE_DEBUG << "Engine::calculateSpectrum" << QThread::currentThread()
    688                  << "count" << m_count << "pos" << position << "len" << m_spectrumLengthBytes
     700                 << "count" << m_count << "pos" << position << "len" << m_spectrumBufferLength
    689701                 << "spectrumAnalyser.isReady" << m_spectrumAnalyser.isReady();
    690702
    691703    if(m_spectrumAnalyser.isReady()) {
    692         m_spectrumBuffer = QByteArray::fromRawData(m_buffer.constData() + position,
    693                                                    m_spectrumLengthBytes);
     704        m_spectrumBuffer = QByteArray::fromRawData(m_buffer.constData() + position - m_bufferPosition,
     705                                                   m_spectrumBufferLength);
    694706        m_spectrumPosition = position;
    695707        m_spectrumAnalyser.calculate(m_spectrumBuffer, m_format);
     
    702714    const bool changed = (format != m_format);
    703715    m_format = format;
     716    m_levelBufferLength = audioLength(m_format, LevelWindowUs);
     717    m_spectrumBufferLength = SpectrumLengthSamples *
     718                            (m_format.sampleSize() / 8) * m_format.channels();
    704719    if (changed)
    705720        emit formatChanged(m_format);
  • trunk/demos/spectrum/app/engine.h

    r769 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)
     
    6666
    6767class FrequencySpectrum;
    68 
    6968QT_FORWARD_DECLARE_CLASS(QAudioInput)
    7069QT_FORWARD_DECLARE_CLASS(QAudioOutput)
     
    9392
    9493    /**
    95      * \return Reference to internal audio buffer
    96      * \note This reference is valid for the lifetime of the Engine
    97      */
    98     const QByteArray& buffer() const    { return m_buffer; }
    99 
    100     /**
    10194     * \return Current audio format
    10295     * \note May be QAudioFormat() if engine is not initialized
     
    131124    /**
    132125     * Position of the audio input device.
    133      * \return Position in microseconds.
     126     * \return Position in bytes.
    134127     */
    135128    qint64 recordPosition() const   { return m_recordPosition; }
     
    149142    /**
    150143     * Position of the audio output device.
    151      * \return Position in microseconds.
     144     * \return Position in bytes.
    152145     */
    153146    qint64 playPosition() const     { return m_playPosition; }
     
    155148    /**
    156149     * Length of the internal engine buffer.
    157      * \return Buffer length in microseconds.
    158      */
    159     qint64 bufferDuration() const;
     150     * \return Buffer length in bytes.
     151     */
     152    qint64 bufferLength() const;
    160153
    161154    /**
    162155     * Amount of data held in the buffer.
    163      * \return Data duration in microseconds.
    164      */
    165     qint64 dataDuration() const;
    166 
    167     /**
    168      * Returns the size of the underlying audio buffer in bytes.
    169      * This should be an approximation of the capture latency.
    170      */
    171     qint64 audioBufferLength() const;
     156     * \return Data length in bytes.
     157     */
     158    qint64 dataLength() const       { return m_dataLength; }
    172159
    173160    /**
     
    205192     * \param duration Duration in microseconds
    206193     */
    207     void bufferDurationChanged(qint64 duration);
     194    void bufferLengthChanged(qint64 duration);
    208195
    209196    /**
    210197     * Amount of data in buffer has changed.
    211      * \param duration Duration of data in microseconds
    212      */
    213     void dataDurationChanged(qint64 duration);
     198     * \param Length of data in bytes
     199     */
     200    void dataLengthChanged(qint64 duration);
    214201
    215202    /**
    216203     * Position of the audio input device has changed.
    217      * \param position Position in microseconds
     204     * \param position Position in bytes
    218205     */
    219206    void recordPositionChanged(qint64 position);
     
    221208    /**
    222209     * Position of the audio output device has changed.
    223      * \param position Position in microseconds
     210     * \param position Position in bytes
    224211     */
    225212    void playPositionChanged(qint64 position);
     
    229216     * \param rmsLevel RMS level in range 0.0 - 1.0
    230217     * \param peakLevel Peak level in range 0.0 - 1.0
    231      * \param numSamples Number of audio samples analysed
     218     * \param numSamples Number of audio samples analyzed
    232219     */
    233220    void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples);
     
    235222    /**
    236223     * Spectrum has changed.
    237      * \param position Position of start of window in microseconds
    238      * \param length   Length of window in microseconds
     224     * \param position Position of start of window in bytes
     225     * \param length   Length of window in bytes
    239226     * \param spectrum Resulting frequency spectrum
    240227     */
    241228    void spectrumChanged(qint64 position, qint64 length, const FrequencySpectrum &spectrum);
     229
     230    /**
     231     * Buffer containing audio data has changed.
     232     * \param position Position of start of buffer in bytes
     233     * \param buffer   Buffer
     234     */
     235    void bufferChanged(qint64 position, qint64 length, const QByteArray &buffer);
    242236
    243237private slots:
     
    248242
    249243private:
     244    void resetAudioDevices();
    250245    bool initialize();
    251246    bool selectFormat();
     
    277272    SweptTone           m_tone;
    278273
    279     QFile*              m_file;
    280     WavFile             m_wavFile;
     274    WavFile*            m_file;
     275    // We need a second file handle via which to read data into m_buffer
     276    // for analysis
     277    WavFile*            m_analysisFile;
    281278
    282279    QAudioFormat        m_format;
     
    295292
    296293    QByteArray          m_buffer;
     294    qint64              m_bufferPosition;
     295    qint64              m_bufferLength;
    297296    qint64              m_dataLength;
    298297
     298    int                 m_levelBufferLength;
    299299    qreal               m_rmsLevel;
    300300    qreal               m_peakLevel;
    301301
    302     int                 m_spectrumLengthBytes;
     302    int                 m_spectrumBufferLength;
    303303    QByteArray          m_spectrumBuffer;
    304304    SpectrumAnalyser    m_spectrumAnalyser;
  • trunk/demos/spectrum/app/frequencyspectrum.cpp

    r769 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/spectrum/app/frequencyspectrum.h

    r769 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/spectrum/app/levelmeter.cpp

    r769 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/spectrum/app/levelmeter.h

    r769 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)
     
    4747/**
    4848 * Widget which displays a vertical audio level meter, indicating the
    49  * RMS and peak levels of the window of audio samples most recently analysed
     49 * RMS and peak levels of the window of audio samples most recently analyzed
    5050 * by the Engine.
    5151 */
  • trunk/demos/spectrum/app/main.cpp

    r769 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)
     
    4545{
    4646    QApplication app(argc, argv);
    47     app.setApplicationName("QtMultimedia spectrum analyser");
     47    app.setApplicationName("QtMultimedia spectrum analyzer");
    4848    MainWidget w;
    4949
  • trunk/demos/spectrum/app/mainwidget.cpp

    r769 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)
     
    6666    ,   m_engine(new Engine(this))
    6767#ifndef DISABLE_WAVEFORM
    68     ,   m_waveform(new Waveform(m_engine->buffer(), this))
     68    ,   m_waveform(new Waveform(this))
    6969#endif
    7070    ,   m_progressBar(new ProgressBar(this))
     
    167167}
    168168
    169 void MainWidget::positionChanged(qint64 positionUs)
    170 {
    171 #ifndef DISABLE_WAVEFORM
    172     qint64 positionBytes = audioLength(m_engine->format(), positionUs);
    173     m_waveform->positionChanged(positionBytes);
     169void MainWidget::audioPositionChanged(qint64 position)
     170{
     171#ifndef DISABLE_WAVEFORM
     172    m_waveform->audioPositionChanged(position);
    174173#else
    175     Q_UNUSED(positionUs)
    176 #endif
    177 }
    178 
    179 void MainWidget::bufferDurationChanged(qint64 durationUs)
    180 {
    181     m_progressBar->bufferDurationChanged(durationUs);
     174    Q_UNUSED(position)
     175#endif
     176}
     177
     178void MainWidget::bufferLengthChanged(qint64 length)
     179{
     180    m_progressBar->bufferLengthChanged(length);
    182181}
    183182
     
    187186//-----------------------------------------------------------------------------
    188187
    189 void MainWidget::dataDurationChanged(qint64 duration)
    190 {
    191 #ifndef DISABLE_WAVEFORM
    192     const qint64 dataLength = audioLength(m_engine->format(), duration);
    193     m_waveform->dataLengthChanged(dataLength);
    194 #else
    195     Q_UNUSED(duration)
    196 #endif
    197 
    198     updateButtonStates();
    199 }
    200 
    201188void MainWidget::showFileDialog()
    202189{
    203     reset();
    204190    const QString dir;
    205191    const QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Open WAV file"), dir, "*.wav");
    206192    if (fileNames.count()) {
     193        reset();
    207194        setMode(LoadFileMode);
    208195        m_engine->loadFile(fileNames.front());
    209196        updateButtonStates();
     197    } else {
     198        updateModeMenu();
    210199    }
    211200}
     
    213202void MainWidget::showSettingsDialog()
    214203{
    215     reset();
    216204    m_settingsDialog->exec();
    217205    if (m_settingsDialog->result() == QDialog::Accepted) {
     
    224212void MainWidget::showToneGeneratorDialog()
    225213{
    226     reset();
    227214    m_toneGeneratorDialog->exec();
    228215    if (m_toneGeneratorDialog->result() == QDialog::Accepted) {
     216        reset();
    229217        setMode(GenerateToneMode);
    230218        const qreal amplitude = m_toneGeneratorDialog->amplitude();
     
    237225            updateButtonStates();
    238226        }
     227    } else {
     228        updateModeMenu();
    239229    }
    240230}
     
    361351            this, SLOT(formatChanged(const QAudioFormat &)));
    362352
    363     m_progressBar->bufferDurationChanged(m_engine->bufferDuration());
    364 
    365     CHECKED_CONNECT(m_engine, SIGNAL(bufferDurationChanged(qint64)),
    366             this, SLOT(bufferDurationChanged(qint64)));
    367 
    368     CHECKED_CONNECT(m_engine, SIGNAL(dataDurationChanged(qint64)),
    369             this, SLOT(dataDurationChanged(qint64)));
     353    m_progressBar->bufferLengthChanged(m_engine->bufferLength());
     354
     355    CHECKED_CONNECT(m_engine, SIGNAL(bufferLengthChanged(qint64)),
     356            this, SLOT(bufferLengthChanged(qint64)));
     357
     358    CHECKED_CONNECT(m_engine, SIGNAL(dataLengthChanged(qint64)),
     359            this, SLOT(updateButtonStates()));
    370360
    371361    CHECKED_CONNECT(m_engine, SIGNAL(recordPositionChanged(qint64)),
     
    376366
    377367    CHECKED_CONNECT(m_engine, SIGNAL(recordPositionChanged(qint64)),
    378             this, SLOT(positionChanged(qint64)));
     368            this, SLOT(audioPositionChanged(qint64)));
    379369
    380370    CHECKED_CONNECT(m_engine, SIGNAL(playPositionChanged(qint64)),
    381             this, SLOT(positionChanged(qint64)));
     371            this, SLOT(audioPositionChanged(qint64)));
    382372
    383373    CHECKED_CONNECT(m_engine, SIGNAL(levelChanged(qreal, qreal, int)),
     
    395385    CHECKED_CONNECT(m_spectrograph, SIGNAL(infoMessage(QString, int)),
    396386            this, SLOT(infoMessage(QString, int)));
     387
     388#ifndef DISABLE_WAVEFORM
     389    CHECKED_CONNECT(m_engine, SIGNAL(bufferChanged(qint64, qint64, const QByteArray &)),
     390            m_waveform, SLOT(bufferChanged(qint64, qint64, const QByteArray &)));
     391#endif
    397392}
    398393
     
    426421    m_pauseButton->setEnabled(pauseEnabled);
    427422
    428     const bool playEnabled = (m_engine->dataDuration() &&
     423    const bool playEnabled = (/*m_engine->dataLength() &&*/
    429424                              (QAudio::AudioOutput != m_engine->mode() ||
    430425                               (QAudio::ActiveState != m_engine->state() &&
     
    446441void MainWidget::setMode(Mode mode)
    447442{
    448 
    449443    m_mode = mode;
    450     m_loadFileAction->setChecked(LoadFileMode == mode);
    451     m_generateToneAction->setChecked(GenerateToneMode == mode);
    452     m_recordAction->setChecked(RecordMode == mode);
    453 }
    454 
     444    updateModeMenu();
     445}
     446
     447void MainWidget::updateModeMenu()
     448{
     449    m_loadFileAction->setChecked(LoadFileMode == m_mode);
     450    m_generateToneAction->setChecked(GenerateToneMode == m_mode);
     451    m_recordAction->setChecked(RecordMode == m_mode);
     452}
     453
  • trunk/demos/spectrum/app/mainwidget.h

    r769 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)
     
    8181    void infoMessage(const QString &message, int timeoutMs);
    8282    void errorMessage(const QString &heading, const QString &detail);
    83     void positionChanged(qint64 position);
    84     void bufferDurationChanged(qint64 duration);
     83    void audioPositionChanged(qint64 position);
     84    void bufferLengthChanged(qint64 length);
    8585
    8686private slots:
     
    8989    void showToneGeneratorDialog();
    9090    void initializeRecord();
    91     void dataDurationChanged(qint64 duration);
     91    void updateModeMenu();
     92    void updateButtonStates();
    9293
    9394private:
     
    9596    void createMenus();
    9697    void connectUi();
    97     void updateButtonStates();
    9898    void reset();
    9999
     
    112112    Engine*                 m_engine;
    113113
     114#ifndef DISABLE_WAVEFORM
    114115    Waveform*               m_waveform;
     116#endif
    115117    ProgressBar*            m_progressBar;
    116118    Spectrograph*           m_spectrograph;
  • trunk/demos/spectrum/app/progressbar.cpp

    r769 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)
     
    4545ProgressBar::ProgressBar(QWidget *parent)
    4646    :   QWidget(parent)
    47     ,   m_bufferDuration(0)
     47    ,   m_bufferLength(0)
    4848    ,   m_recordPosition(0)
    4949    ,   m_playPosition(0)
     
    6565void ProgressBar::reset()
    6666{
    67     m_bufferDuration = 0;
     67    m_bufferLength = 0;
    6868    m_recordPosition = 0;
    6969    m_playPosition = 0;
     
    8787#endif
    8888
    89     if (m_bufferDuration) {
     89    if (m_bufferLength) {
    9090        QRect bar = rect();
    91         const qreal play = qreal(m_playPosition) / m_bufferDuration;
     91        const qreal play = qreal(m_playPosition) / m_bufferLength;
    9292        bar.setLeft(rect().left() + play * rect().width());
    93         const qreal record = qreal(m_recordPosition) / m_bufferDuration;
     93        const qreal record = qreal(m_recordPosition) / m_bufferLength;
    9494        bar.setRight(rect().left() + record * rect().width());
    9595        painter.fillRect(bar, bufferColor);
    9696
    9797        QRect window = rect();
    98         const qreal windowLeft = qreal(m_windowPosition) / m_bufferDuration;
     98        const qreal windowLeft = qreal(m_windowPosition) / m_bufferLength;
    9999        window.setLeft(rect().left() + windowLeft * rect().width());
    100         const qreal windowWidth = qreal(m_windowLength) / m_bufferDuration;
     100        const qreal windowWidth = qreal(m_windowLength) / m_bufferLength;
    101101        window.setWidth(windowWidth * rect().width());
    102102        painter.fillRect(window, windowColor);
     
    104104}
    105105
    106 void ProgressBar::bufferDurationChanged(qint64 bufferSize)
     106void ProgressBar::bufferLengthChanged(qint64 bufferSize)
    107107{
    108     m_bufferDuration = bufferSize;
     108    m_bufferLength = bufferSize;
    109109    m_recordPosition = 0;
    110110    m_playPosition = 0;
     
    117117{
    118118    Q_ASSERT(recordPosition >= 0);
    119     Q_ASSERT(recordPosition <= m_bufferDuration);
     119    Q_ASSERT(recordPosition <= m_bufferLength);
    120120    m_recordPosition = recordPosition;
    121121    repaint();
     
    125125{
    126126    Q_ASSERT(playPosition >= 0);
    127     Q_ASSERT(playPosition <= m_bufferDuration);
     127    Q_ASSERT(playPosition <= m_bufferLength);
    128128    m_playPosition = playPosition;
    129129    repaint();
     
    133133{
    134134    Q_ASSERT(position >= 0);
    135     Q_ASSERT(position <= m_bufferDuration);
    136     Q_ASSERT(position + length <= m_bufferDuration);
     135    Q_ASSERT(position <= m_bufferLength);
     136    Q_ASSERT(position + length <= m_bufferLength);
    137137    m_windowPosition = position;
    138138    m_windowLength = length;
  • trunk/demos/spectrum/app/progressbar.h

    r769 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)
     
    5858
    5959public slots:
    60     void bufferDurationChanged(qint64 bufferSize);
     60    void bufferLengthChanged(qint64 length);
    6161    void recordPositionChanged(qint64 recordPosition);
    6262    void playPositionChanged(qint64 playPosition);
     
    6464
    6565private:
    66     qint64 m_bufferDuration;
     66    qint64 m_bufferLength;
    6767    qint64 m_recordPosition;
    6868    qint64 m_playPosition;
  • trunk/demos/spectrum/app/settingsdialog.cpp

    r769 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/spectrum/app/settingsdialog.h

    r769 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/spectrum/app/spectrograph.cpp

    r769 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/spectrum/app/spectrograph.h

    r769 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)
     
    4949/**
    5050 * Widget which displays a spectrograph showing the frequency spectrum
    51  * of the window of audio samples most recently analysed by the Engine.
     51 * of the window of audio samples most recently analyzed by the Engine.
    5252 */
    5353class Spectrograph : public QWidget {
  • trunk/demos/spectrum/app/spectrum.h

    r769 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/spectrum/app/spectrumanalyser.cpp

    r769 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)
     
    6565{
    6666#ifdef SPECTRUM_ANALYSER_SEPARATE_THREAD
     67    // moveToThread() cannot be called on a QObject with a parent
     68    setParent(0);
    6769    moveToThread(m_thread);
    6870    m_thread->start();
     
    125127    m_fft->calculateFFT(m_output.data(), m_input.data());
    126128
    127     // Analyse output to obtain amplitude and phase for each frequency
     129    // Analyze output to obtain amplitude and phase for each frequency
    128130    for (int i=2; i<=m_numSamples/2; ++i) {
    129131        // Calculate frequency of this complex sample
  • trunk/demos/spectrum/app/spectrumanalyser.h

    r769 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/spectrum/app/tonegenerator.cpp

    r769 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/spectrum/app/tonegenerator.h

    r769 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/spectrum/app/tonegeneratordialog.cpp

    r769 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/spectrum/app/tonegeneratordialog.h

    r769 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/spectrum/app/utils.cpp

    r769 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)
     
    5050qint64 audioLength(const QAudioFormat &format, qint64 microSeconds)
    5151{
    52    return (format.frequency() * format.channels() * (format.sampleSize() / 8))
     52   qint64 result = (format.frequency() * format.channels() * (format.sampleSize() / 8))
    5353       * microSeconds / 1000000;
     54   result -= result % (format.channelCount() * format.sampleSize());
     55   return result;
    5456}
    5557
  • trunk/demos/spectrum/app/utils.h

    r769 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/spectrum/app/waveform.cpp

    r769 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)
     
    4545#include <QDebug>
    4646
    47 
    48 Waveform::Waveform(const QByteArray &buffer, QWidget *parent)
     47//#define PAINT_EVENT_TRACE
     48#ifdef PAINT_EVENT_TRACE
     49#   define WAVEFORM_PAINT_DEBUG qDebug()
     50#else
     51#   define WAVEFORM_PAINT_DEBUG nullDebug()
     52#endif
     53
     54Waveform::Waveform(QWidget *parent)
    4955    :   QWidget(parent)
    50     ,   m_buffer(buffer)
    51     ,   m_dataLength(0)
    52     ,   m_position(0)
     56    ,   m_bufferPosition(0)
     57    ,   m_bufferLength(0)
     58    ,   m_audioPosition(0)
    5359    ,   m_active(false)
    5460    ,   m_tileLength(0)
     
    7379
    7480    if (m_active) {
    75         WAVEFORM_DEBUG << "Waveform::paintEvent"
    76                        << "windowPosition" << m_windowPosition
    77                        << "windowLength" << m_windowLength;
     81        WAVEFORM_PAINT_DEBUG << "Waveform::paintEvent"
     82                             << "windowPosition" << m_windowPosition
     83                             << "windowLength" << m_windowLength;
    7884        qint64 pos = m_windowPosition;
    7985        const qint64 windowEnd = m_windowPosition + m_windowLength;
     
    8288        while (pos < windowEnd) {
    8389            const TilePoint point = tilePoint(pos);
    84             WAVEFORM_DEBUG << "Waveform::paintEvent" << "pos" << pos
    85                            << "tileIndex" << point.index
    86                            << "positionOffset" << point.positionOffset
    87                            << "pixelOffset" << point.pixelOffset;
     90            WAVEFORM_PAINT_DEBUG << "Waveform::paintEvent" << "pos" << pos
     91                                 << "tileIndex" << point.index
     92                                 << "positionOffset" << point.positionOffset
     93                                 << "pixelOffset" << point.pixelOffset;
    8894
    8995            if (point.index != NullIndex) {
     
    105111                    sourceRect.setRight(sourceRight);
    106112
    107                     WAVEFORM_DEBUG << "Waveform::paintEvent" << "tileIndex" << point.index
    108                                    << "source" << point.pixelOffset << sourceRight
    109                                    << "dest" << destLeft << destRight;
     113                    WAVEFORM_PAINT_DEBUG << "Waveform::paintEvent" << "tileIndex" << point.index
     114                                         << "source" << point.pixelOffset << sourceRight
     115                                         << "dest" << destLeft << destRight;
    110116
    111117                    painter.drawPixmap(destRect, *tile.pixmap, sourceRect);
     
    115121                    if (point.index < m_tiles.count()) {
    116122                        pos = tilePosition(point.index + 1);
    117                         WAVEFORM_DEBUG << "Waveform::paintEvent" << "pos ->" << pos;
     123                        WAVEFORM_PAINT_DEBUG << "Waveform::paintEvent" << "pos ->" << pos;
    118124                    } else {
    119125                        // Reached end of tile array
    120                         WAVEFORM_DEBUG << "Waveform::paintEvent" << "reached end of tile array";
     126                        WAVEFORM_PAINT_DEBUG << "Waveform::paintEvent" << "reached end of tile array";
    121127                        break;
    122128                    }
    123129                } else {
    124130                    // Passed last tile which is painted
    125                     WAVEFORM_DEBUG << "Waveform::paintEvent" << "tile" << point.index << "not painted";
     131                    WAVEFORM_PAINT_DEBUG << "Waveform::paintEvent" << "tile" << point.index << "not painted";
    126132                    break;
    127133                }
    128134            } else {
    129135                // pos is past end of tile array
    130                 WAVEFORM_DEBUG << "Waveform::paintEvent" << "pos" << pos << "past end of tile array";
     136                WAVEFORM_PAINT_DEBUG << "Waveform::paintEvent" << "pos" << pos << "past end of tile array";
    131137                break;
    132138            }
    133139        }
    134140
    135         WAVEFORM_DEBUG << "Waveform::paintEvent" << "final pos" << pos << "final x" << destRight;
     141        WAVEFORM_PAINT_DEBUG << "Waveform::paintEvent" << "final pos" << pos << "final x" << destRight;
    136142    }
    137143}
     
    147153    WAVEFORM_DEBUG << "Waveform::initialize"
    148154                   << "audioBufferSize" << audioBufferSize
    149                    << "m_buffer.size()" << m_buffer.size()
    150155                   << "windowDurationUs" << windowDurationUs;
    151156
     
    187192    WAVEFORM_DEBUG << "Waveform::reset";
    188193
    189     m_dataLength = 0;
    190     m_position = 0;
     194    m_bufferPosition = 0;
     195    m_buffer = QByteArray();
     196    m_audioPosition = 0;
    191197    m_format = QAudioFormat();
    192198    m_active = false;
     
    199205}
    200206
    201 void Waveform::dataLengthChanged(qint64 length)
    202 {
    203     WAVEFORM_DEBUG << "Waveform::dataLengthChanged" << length;
    204     const qint64 oldLength = m_dataLength;
    205     m_dataLength = length;
    206 
    207     if (m_active) {
    208         if (m_dataLength < oldLength)
    209             positionChanged(m_dataLength);
    210         else
    211             paintTiles();
    212     }
    213 }
    214 
    215 void Waveform::positionChanged(qint64 position)
    216 {
    217     WAVEFORM_DEBUG << "Waveform::positionChanged" << position;
    218 
    219     if (position + m_windowLength > m_dataLength)
    220         position = m_dataLength - m_windowLength;
    221 
    222     m_position = position;
    223 
    224     setWindowPosition(position);
     207void Waveform::bufferChanged(qint64 position, qint64 length, const QByteArray &buffer)
     208{
     209    WAVEFORM_DEBUG << "Waveform::bufferChanged"
     210                   << "audioPosition" << m_audioPosition
     211                   << "bufferPosition" << position
     212                   << "bufferLength" << length;
     213    m_bufferPosition = position;
     214    m_bufferLength = length;
     215    m_buffer = buffer;
     216    paintTiles();
     217}
     218
     219void Waveform::audioPositionChanged(qint64 position)
     220{
     221    WAVEFORM_DEBUG << "Waveform::audioPositionChanged"
     222                   << "audioPosition" << position
     223                   << "bufferPosition" << m_bufferPosition
     224                   << "bufferLength" << m_bufferLength;
     225
     226    if (position >= m_bufferPosition) {
     227        if (position + m_windowLength > m_bufferPosition + m_bufferLength)
     228            position = qMax(qint64(0), m_bufferPosition + m_bufferLength - m_windowLength);
     229        m_audioPosition = position;
     230        setWindowPosition(position);
     231    }
    225232}
    226233
     
    256263        m_tiles[i].painted = false;
    257264    }
    258 
    259     paintTiles();
    260265}
    261266
     
    328333        const Tile &tile = m_tiles[i];
    329334        if (!tile.painted) {
    330             const qint64 tileEnd = m_tileArrayStart + (i + 1) * m_tileLength;
    331             if (m_dataLength >= tileEnd) {
     335            const qint64 tileStart = m_tileArrayStart + i * m_tileLength;
     336            const qint64 tileEnd = tileStart + m_tileLength;
     337            if (m_bufferPosition <= tileStart && m_bufferPosition + m_bufferLength >= tileEnd) {
    332338                paintTile(i);
    333339                updateRequired = true;
     
    344350void Waveform::paintTile(int index)
    345351{
    346     WAVEFORM_DEBUG << "Waveform::paintTile" << "index" << index;
    347 
    348352    const qint64 tileStart = m_tileArrayStart + index * m_tileLength;
    349     Q_ASSERT(m_dataLength >= tileStart + m_tileLength);
     353
     354    WAVEFORM_DEBUG << "Waveform::paintTile"
     355                   << "index" << index
     356                   << "bufferPosition" << m_bufferPosition
     357                   << "bufferLength" << m_bufferLength
     358                   << "start" << tileStart
     359                   << "end" << tileStart + m_tileLength;
     360
     361    Q_ASSERT(m_bufferPosition <= tileStart);
     362    Q_ASSERT(m_bufferPosition + m_bufferLength >= tileStart + m_tileLength);
    350363
    351364    Tile &tile = m_tiles[index];
     
    353366
    354367    const qint16* base = reinterpret_cast<const qint16*>(m_buffer.constData());
    355     const qint16* buffer = base + (tileStart / 2);
     368    const qint16* buffer = base + ((tileStart - m_bufferPosition) / 2);
    356369    const int numSamples = m_tileLength / (2 * m_format.channels());
    357370
     
    377390    for (int i=0; i<numSamples; ++i) {
    378391        const qint16* ptr = buffer + i * m_format.channels();
     392
     393        const int offset = reinterpret_cast<const char*>(ptr) - m_buffer.constData();
     394        Q_ASSERT(offset >= 0);
     395        Q_ASSERT(offset < m_bufferLength);
     396
    379397        const qint16 pcmValue = *ptr;
    380398        const qreal realValue = pcmToReal(pcmValue);
  • trunk/demos/spectrum/app/waveform.h

    r769 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)
     
    6161    Q_OBJECT
    6262public:
    63     Waveform(const QByteArray &buffer, QWidget *parent = 0);
     63    Waveform(QWidget *parent = 0);
    6464    ~Waveform();
    6565
     
    7474
    7575public slots:
    76     void dataLengthChanged(qint64 length);
    77     void positionChanged(qint64 position);
     76    void bufferChanged(qint64 position, qint64 length, const QByteArray &buffer);
     77    void audioPositionChanged(qint64 position);
    7878
    7979private:
     
    168168
    169169private:
    170     const QByteArray&       m_buffer;
    171     qint64                  m_dataLength;
    172     qint64                  m_position;
     170    qint64                  m_bufferPosition;
     171    qint64                  m_bufferLength;
     172    QByteArray              m_buffer;
     173
     174    qint64                  m_audioPosition;
    173175    QAudioFormat            m_format;
    174176
  • trunk/demos/spectrum/app/wavfile.cpp

    r769 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)
     
    7777    RIFFHeader  riff;
    7878    WAVEHeader  wave;
    79     DATAHeader  data;
    8079};
    8180
    82 static const int HeaderLength = sizeof(CombinedHeader);
    83 
    84 
    85 WavFile::WavFile(const QAudioFormat &format, qint64 dataLength)
    86     :   m_format(format)
    87     ,   m_dataLength(dataLength)
     81WavFile::WavFile(QObject *parent)
     82    : QFile(parent)
     83    , m_headerLength(0)
    8884{
    8985
    9086}
    9187
    92 bool WavFile::readHeader(QIODevice &device)
     88bool WavFile::open(const QString &fileName)
    9389{
    94     bool result = true;
     90    close();
     91    setFileName(fileName);
     92    return QFile::open(QIODevice::ReadOnly) && readHeader();
     93}
    9594
    96     if (!device.isSequential())
    97         result = device.seek(0);
    98     // else, assume that current position is the start of the header
     95const QAudioFormat &WavFile::fileFormat() const
     96{
     97    return m_fileFormat;
     98}
    9999
     100qint64 WavFile::headerLength() const
     101{
     102return m_headerLength;
     103}
     104
     105bool WavFile::readHeader()
     106{
     107    seek(0);
     108    CombinedHeader header;
     109    bool result = read(reinterpret_cast<char *>(&header), sizeof(CombinedHeader)) == sizeof(CombinedHeader);
    100110    if (result) {
    101         CombinedHeader header;
    102         result = (device.read(reinterpret_cast<char *>(&header), HeaderLength) == HeaderLength);
    103         if (result) {
    104             if ((memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0
    105                 || memcmp(&header.riff.descriptor.id, "RIFX", 4) == 0)
    106                 && memcmp(&header.riff.type, "WAVE", 4) == 0
    107                 && memcmp(&header.wave.descriptor.id, "fmt ", 4) == 0
    108                 && header.wave.audioFormat == 1 // PCM
    109             ) {
    110                 if (memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0)
    111                     m_format.setByteOrder(QAudioFormat::LittleEndian);
    112                 else
    113                     m_format.setByteOrder(QAudioFormat::BigEndian);
     111        if ((memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0
     112            || memcmp(&header.riff.descriptor.id, "RIFX", 4) == 0)
     113            && memcmp(&header.riff.type, "WAVE", 4) == 0
     114            && memcmp(&header.wave.descriptor.id, "fmt ", 4) == 0
     115            && (header.wave.audioFormat == 1 || header.wave.audioFormat == 0)) {
    114116
    115                 m_format.setChannels(qFromLittleEndian<quint16>(header.wave.numChannels));
    116                 m_format.setCodec("audio/pcm");
    117                 m_format.setFrequency(qFromLittleEndian<quint32>(header.wave.sampleRate));
    118                 m_format.setSampleSize(qFromLittleEndian<quint16>(header.wave.bitsPerSample));
     117            // Read off remaining header information
     118            DATAHeader dataHeader;
    119119
    120                 switch(header.wave.bitsPerSample) {
    121                 case 8:
    122                     m_format.setSampleType(QAudioFormat::UnSignedInt);
    123                     break;
    124                 case 16:
    125                     m_format.setSampleType(QAudioFormat::SignedInt);
    126                     break;
    127                 default:
    128                     result = false;
    129                 }
     120            if (qFromLittleEndian<quint32>(header.wave.descriptor.size) > sizeof(WAVEHeader)) {
     121                // Extended data available
     122                quint16 extraFormatBytes;
     123                if (peek((char*)&extraFormatBytes, sizeof(quint16)) != sizeof(quint16))
     124                    return false;
     125                const qint64 throwAwayBytes = sizeof(quint16) + qFromLittleEndian<quint16>(extraFormatBytes);
     126                if (read(throwAwayBytes).size() != throwAwayBytes)
     127                    return false;
     128            }
    130129
    131                 m_dataLength = device.size() - HeaderLength;
    132             } else {
    133                 result = false;
    134             }
     130            if (read((char*)&dataHeader, sizeof(DATAHeader)) != sizeof(DATAHeader))
     131                return false;
     132
     133            // Establish format
     134            if (memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0)
     135                m_fileFormat.setByteOrder(QAudioFormat::LittleEndian);
     136            else
     137                m_fileFormat.setByteOrder(QAudioFormat::BigEndian);
     138
     139            int bps = qFromLittleEndian<quint16>(header.wave.bitsPerSample);
     140            m_fileFormat.setChannels(qFromLittleEndian<quint16>(header.wave.numChannels));
     141            m_fileFormat.setCodec("audio/pcm");
     142            m_fileFormat.setFrequency(qFromLittleEndian<quint32>(header.wave.sampleRate));
     143            m_fileFormat.setSampleSize(qFromLittleEndian<quint16>(header.wave.bitsPerSample));
     144            m_fileFormat.setSampleType(bps == 8 ? QAudioFormat::UnSignedInt : QAudioFormat::SignedInt);
     145        } else {
     146            result = false;
    135147        }
    136148    }
    137 
     149    m_headerLength = pos();
    138150    return result;
    139151}
    140 
    141 bool WavFile::writeHeader(QIODevice &device)
    142 {
    143     CombinedHeader header;
    144 
    145     memset(&header, 0, HeaderLength);
    146 
    147     // RIFF header
    148     if (m_format.byteOrder() == QAudioFormat::LittleEndian)
    149         strncpy(&header.riff.descriptor.id[0], "RIFF", 4);
    150     else
    151         strncpy(&header.riff.descriptor.id[0], "RIFX", 4);
    152     qToLittleEndian<quint32>(quint32(m_dataLength + HeaderLength - 8),
    153                              reinterpret_cast<unsigned char*>(&header.riff.descriptor.size));
    154     strncpy(&header.riff.type[0], "WAVE", 4);
    155 
    156     // WAVE header
    157     strncpy(&header.wave.descriptor.id[0], "fmt ", 4);
    158     qToLittleEndian<quint32>(quint32(16),
    159                              reinterpret_cast<unsigned char*>(&header.wave.descriptor.size));
    160     qToLittleEndian<quint16>(quint16(1),
    161                              reinterpret_cast<unsigned char*>(&header.wave.audioFormat));
    162     qToLittleEndian<quint16>(quint16(m_format.channels()),
    163                              reinterpret_cast<unsigned char*>(&header.wave.numChannels));
    164     qToLittleEndian<quint32>(quint32(m_format.frequency()),
    165                              reinterpret_cast<unsigned char*>(&header.wave.sampleRate));
    166     qToLittleEndian<quint32>(quint32(m_format.frequency() * m_format.channels() * m_format.sampleSize() / 8),
    167                              reinterpret_cast<unsigned char*>(&header.wave.byteRate));
    168     qToLittleEndian<quint16>(quint16(m_format.channels() * m_format.sampleSize() / 8),
    169                              reinterpret_cast<unsigned char*>(&header.wave.blockAlign));
    170     qToLittleEndian<quint16>(quint16(m_format.sampleSize()),
    171                              reinterpret_cast<unsigned char*>(&header.wave.bitsPerSample));
    172 
    173     // DATA header
    174     strncpy(&header.data.descriptor.id[0], "data", 4);
    175     qToLittleEndian<quint32>(quint32(m_dataLength),
    176                              reinterpret_cast<unsigned char*>(&header.data.descriptor.size));
    177 
    178     return (device.write(reinterpret_cast<const char *>(&header), HeaderLength) == HeaderLength);
    179 }
    180 
    181 const QAudioFormat& WavFile::format() const
    182 {
    183     return m_format;
    184 }
    185 
    186 qint64 WavFile::dataLength() const
    187 {
    188     return m_dataLength;
    189 }
    190 
    191 qint64 WavFile::headerLength()
    192 {
    193     return HeaderLength;
    194 }
    195 
    196 bool WavFile::writeDataLength(QIODevice &device, qint64 dataLength)
    197 {
    198     bool result = false;
    199     if (!device.isSequential()) {
    200         device.seek(40);
    201         unsigned char dataLengthLE[4];
    202         qToLittleEndian<quint32>(quint32(dataLength), dataLengthLE);
    203         result = (device.write(reinterpret_cast<const char *>(dataLengthLE), 4) == 4);
    204     }
    205     return result;
    206 }
    207 
    208 #include <QFile>
    209 #include <QTextStream>
    210 
    211 qint64 WavFile::readData(QIODevice &device, QByteArray &buffer,
    212                          QAudioFormat outputFormat)
    213 {
    214     if (QAudioFormat() == outputFormat)
    215         outputFormat = m_format;
    216 
    217     qint64 result = 0;
    218 
    219     QFile file("wav.txt");
    220     file.open(QIODevice::WriteOnly | QIODevice::Text);
    221     QTextStream stream;
    222     stream.setDevice(&file);
    223 
    224     if (isPCMS16LE(outputFormat) && isPCMS16LE(m_format)) {
    225         QVector<char> inputSample(2 * m_format.channels());
    226 
    227         qint16 *output = reinterpret_cast<qint16*>(buffer.data());
    228 
    229         while (result < buffer.size()) {
    230             if (device.read(inputSample.data(), inputSample.count())) {
    231                 int inputIdx = 0;
    232                 for (int outputIdx = 0; outputIdx < outputFormat.channels(); ++outputIdx) {
    233                     const qint16* input = reinterpret_cast<const qint16*>(inputSample.data() + 2 * inputIdx);
    234                     *output++ = qFromLittleEndian<qint16>(*input);
    235                     result += 2;
    236                     if (inputIdx < m_format.channels())
    237                         ++inputIdx;
    238                 }
    239             } else {
    240                 break;
    241             }
    242         }
    243     }
    244     return result;
    245 }
    246 
  • trunk/demos/spectrum/app/wavfile.h

    r769 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)
     
    4747#include <QtMultimedia/qaudioformat.h>
    4848
    49 /**
    50  * Helper class for reading WAV files
    51  *
    52  * See https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
    53  */
    54 class WavFile
     49class WavFile : public QFile
    5550{
    5651public:
    57     WavFile(const QAudioFormat &format = QAudioFormat(),
    58               qint64 dataLength = 0);
     52    WavFile(QObject *parent = 0);
    5953
    60     // Reads WAV header and seeks to start of data
    61     bool readHeader(QIODevice &device);
    62 
    63     // Writes WAV header
    64     bool writeHeader(QIODevice &device);
    65 
    66     // Read PCM data
    67     qint64 readData(QIODevice &device, QByteArray &buffer,
    68                     QAudioFormat outputFormat = QAudioFormat());
    69 
    70     const QAudioFormat& format() const;
    71     qint64 dataLength() const;
    72 
    73     static qint64 headerLength();
    74 
    75     static bool writeDataLength(QIODevice &device, qint64 dataLength);
     54    bool open(const QString &fileName);
     55    const QAudioFormat &fileFormat() const;
     56    qint64 headerLength() const;
    7657
    7758private:
    78     QAudioFormat m_format;
    79     qint64 m_dataLength;
     59    bool readHeader();
     60
     61private:
     62    QAudioFormat m_fileFormat;
     63    qint64 m_headerLength;
     64
    8065};
    8166
  • trunk/demos/spectrum/spectrum.pri

    r769 r846  
    3636win32: DEFINES += _CRT_SECURE_NO_WARNINGS
    3737
     38win32 {
     39    # spectrum_build_dir is defined with a leading slash so that it can
     40    # be used in contexts such as
     41    #     ..$${spectrum_build_dir}
     42    # without the result having a trailing slash where spectrum_build_dir
     43    # is undefined.
     44    spectrum_build_dir = /release
     45    if (!debug_and_release|build_pass): CONFIG(debug, debug|release) {
     46        spectrum_build_dir = /debug
     47    }
     48}
     49
  • trunk/demos/spectrum/spectrum.pro

    r769 r846  
    1515
    1616symbian {
    17     load(data_caging_paths)
    18 
    1917    # Create a 'make sis' rule which can be run from the top-level
    2018
     
    2220
    2321    # UID for the SIS file
    24     TARGET.UID3 = 0xA000E3FA
     22    TARGET.UID3 = 0xA000E402
    2523}
    2624
  • trunk/demos/spreadsheet/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/spreadsheet/printview.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/spreadsheet/printview.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/spreadsheet/spreadsheet.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)
     
    7171    setupMenuBar();
    7272    setupContents();
     73    setupContextMenu();
    7374    setCentralWidget(table);
    7475
     
    511512    table->setItem(0, 2, new SpreadSheetItem("Price"));
    512513    table->item(0, 2)->setBackgroundColor(titleBackground);
    513     table->item(0, 2)->setToolTip("This collumn shows the price of the purchase");
     514    table->item(0, 2)->setToolTip("This column shows the price of the purchase");
    514515    table->item(0, 2)->setFont(titleFont);
    515516
  • trunk/demos/spreadsheet/spreadsheet.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/spreadsheet/spreadsheetdelegate.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/spreadsheet/spreadsheetdelegate.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/spreadsheet/spreadsheetitem.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/spreadsheet/spreadsheetitem.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/sqlbrowser/browser.cpp

    r769 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)
     
    243243{
    244244    QMessageBox::about(this, tr("About"), tr("The SQL Browser demonstration "
    245         "show how a data browser can be used to visualize the results of SQL"
     245        "shows how a data browser can be used to visualize the results of SQL"
    246246        "statements on a live database"));
    247247}
  • trunk/demos/sqlbrowser/browser.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/sqlbrowser/connectionwidget.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/sqlbrowser/connectionwidget.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/sqlbrowser/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/sqlbrowser/qsqlconnectiondialog.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/sqlbrowser/qsqlconnectiondialog.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/sub-attaq/animationmanager.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/sub-attaq/animationmanager.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/sub-attaq/boat.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/sub-attaq/boat.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/sub-attaq/boat_p.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/sub-attaq/bomb.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/sub-attaq/bomb.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/sub-attaq/graphicsscene.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/sub-attaq/graphicsscene.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/sub-attaq/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/sub-attaq/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)
  • trunk/demos/sub-attaq/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)
  • trunk/demos/sub-attaq/pixmapitem.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/sub-attaq/pixmapitem.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/sub-attaq/progressitem.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/sub-attaq/progressitem.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/sub-attaq/qanimationstate.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/sub-attaq/qanimationstate.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/sub-attaq/states.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/sub-attaq/states.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/sub-attaq/submarine.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/sub-attaq/submarine.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/sub-attaq/submarine_p.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/sub-attaq/textinformationitem.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/sub-attaq/textinformationitem.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/sub-attaq/torpedo.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/sub-attaq/torpedo.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/symbianpkgrules.pri

    r769 r846  
    33RSS_RULES ="group_name=\"QtDemos\";"
    44
     5nokiaVendor = "Nokia, Qt"
    56vendorinfo = \
    67    "; Localised Vendor name" \
    7     "%{\"Nokia, Qt\"}" \
     8    "%{$$addLanguageDependentPkgItem(nokiaVendor)}" \
    89    " " \
    910    "; Unique Vendor name" \
    10     ":\"Nokia, Qt\"" \
     11    ":\"$$nokiaVendor\"" \
    1112    " "
    1213
     
    1415DEPLOYMENT += demos_deployment
    1516
    16 isEmpty(ICON):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg
     17isEmpty(ICON):contains(TEMPLATE, ".*app"):contains(QT, gui):contains(CONFIG, qt):!contains(CONFIG, "no_icon") {
     18    ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg
     19}
  • trunk/demos/textedit/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/textedit/textedit.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)
     
    263263    menu->addAction(a);
    264264#ifndef QT_NO_CLIPBOARD
    265     actionPaste->setEnabled(!QApplication::clipboard()->text().isEmpty());
     265    if (const QMimeData *md = QApplication::clipboard()->mimeData())
     266        actionPaste->setEnabled(md->hasText());
    266267#endif
    267268}
     
    682683{
    683684#ifndef QT_NO_CLIPBOARD
    684     actionPaste->setEnabled(!QApplication::clipboard()->text().isEmpty());
     685    if (const QMimeData *md = QApplication::clipboard()->mimeData())
     686        actionPaste->setEnabled(md->hasText());
    685687#endif
    686688}
  • trunk/demos/textedit/textedit.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/textedit/textedit.qdoc

    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)
     
    77** This file is part of the documentation of the Qt Toolkit.
    88**
    9 ** $QT_BEGIN_LICENSE:LGPL$
     9** $QT_BEGIN_LICENSE:FDL$
    1010** Commercial Usage
    1111** Licensees holding valid Qt Commercial licenses may use this file in
    1212** accordance with the Qt Commercial License Agreement provided with the
    13 ** Software or, alternatively, in accordance with the terms contained in
    14 ** a written agreement between you and Nokia.
     13** Software or, alternatively, in accordance with the terms contained in a
     14** written agreement between you and Nokia.
    1515**
    16 ** GNU Lesser General Public License Usage
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
    18 ** General Public License version 2.1 as published by the Free Software
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
    20 ** packaging of this file.  Please review the following information to
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    23 **
    24 ** In addition, as a special exception, Nokia gives you certain additional
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    27 **
    28 ** GNU General Public License Usage
    29 ** Alternatively, this file may be used under the terms of the GNU
    30 ** General Public License version 3.0 as published by the Free Software
    31 ** Foundation and appearing in the file LICENSE.GPL included in the
    32 ** packaging of this file.  Please review the following information to
    33 ** ensure the GNU General Public License version 3.0 requirements will be
    34 ** met: http://www.gnu.org/copyleft/gpl.html.
     16** GNU Free Documentation License
     17** Alternatively, this file may be used under the terms of the GNU Free
     18** Documentation License version 1.3 as published by the Free Software
     19** Foundation and appearing in the file included in the packaging of this
     20** file.
    3521**
    3622** If you have questions regarding the use of this file, please contact
  • trunk/demos/undo/commands.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/undo/commands.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/undo/document.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/undo/document.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/undo/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/undo/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)
  • trunk/demos/undo/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)
Note: See TracChangeset for help on using the changeset viewer.