diff options
author | Andrew Stanley-Jones <andrew.stanley-jones@nokia.com> | 2011-07-26 11:40:52 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-26 03:51:38 +0200 |
commit | 768fd5acc721e5edf11aa1a8efbaf6d18c0dcc76 (patch) | |
tree | 16d19787f7806d9dd7d3851b5fc90cc859e17fcb /examples | |
parent | 5c1134156716c9e05013e5502405e2caf9efc8f0 (diff) |
Changes in autogenerated QML wrappers
Change-Id: I6df8e15890934a5f8f88ce0c3907b3dc7814815d
Reviewed-on: http://codereview.qt.nokia.com/2141
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Andrew Stanley-Jones <andrew.stanley-jones@nokia.com>
Diffstat (limited to 'examples')
3 files changed, 95 insertions, 110 deletions
diff --git a/examples/serviceframework/dialer/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/serviceframework/dialer/qmlapplicationviewer/qmlapplicationviewer.cpp index 11bedd19..b3e862c9 100644 --- a/examples/serviceframework/dialer/qmlapplicationviewer/qmlapplicationviewer.cpp +++ b/examples/serviceframework/dialer/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -1,4 +1,4 @@ -// checksum 0x28c7 version 0x2000a +// checksum 0x7895 version 0x4000b /* This file was generated by the Qt Quick Application wizard of Qt Creator. QmlApplicationViewer is a convenience class containing mobile device specific @@ -28,13 +28,6 @@ #include <qdeclarativeviewobserver.h> #endif -#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) -#include <eikenv.h> -#include <eikappui.h> -#include <aknenv.h> -#include <aknappui.h> -#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK - #if defined(QMLJSDEBUGGER) // Enable debugging before any QDeclarativeEngine is created @@ -66,12 +59,13 @@ QString QmlApplicationViewerPrivate::adjustPath(const QString &path) return QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/") + path; #else - const QString pathInShareDir = QCoreApplication::applicationDirPath() - + QLatin1String("/../share/") - + QFileInfo(QCoreApplication::applicationFilePath()).fileName() - + QLatin1Char('/') + path; - if (QFileInfo(pathInShareDir).exists()) - return pathInShareDir; + const QString pathInInstallDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../") + path; + if (pathInInstallDir.contains(QLatin1String("opt")) + && pathInInstallDir.contains(QLatin1String("bin")) + && QFileInfo(pathInInstallDir).exists()) { + return pathInInstallDir; + } #endif #endif return path; @@ -87,7 +81,7 @@ QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : new QmlJSDebugger::JSDebuggerAgent(engine()); #endif #if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) - new QmlJSDebugger::QDeclarativeViewObserver(this, parent); + new QmlJSDebugger::QDeclarativeViewObserver(this, this); #endif } @@ -109,47 +103,52 @@ void QmlApplicationViewer::addImportPath(const QString &path) void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) { -#ifdef Q_OS_SYMBIAN +#if defined(Q_OS_SYMBIAN) + // If the version of Qt on the device is < 4.7.2, that attribute won't work if (orientation != ScreenOrientationAuto) { -#if defined(ORIENTATIONLOCK) - const CAknAppUiBase::TAppUiOrientation uiOrientation = - (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait - : CAknAppUi::EAppUiOrientationLandscape; - CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); - TRAPD(error, - if (appUi) - appUi->SetOrientationL(uiOrientation); - ); - Q_UNUSED(error) -#else // ORIENTATIONLOCK - qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); -#endif // ORIENTATIONLOCK + const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); + if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { + qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); + return; + } } -#elif defined(Q_WS_MAEMO_5) +#endif // Q_OS_SYMBIAN + Qt::WidgetAttribute attribute; switch (orientation) { +#if QT_VERSION < 0x040702 + // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes case ScreenOrientationLockPortrait: - attribute = Qt::WA_Maemo5PortraitOrientation; + attribute = static_cast<Qt::WidgetAttribute>(128); break; case ScreenOrientationLockLandscape: - attribute = Qt::WA_Maemo5LandscapeOrientation; + attribute = static_cast<Qt::WidgetAttribute>(129); break; + default: case ScreenOrientationAuto: + attribute = static_cast<Qt::WidgetAttribute>(130); + break; +#else // QT_VERSION < 0x040702 + case ScreenOrientationLockPortrait: + attribute = Qt::WA_LockPortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_LockLandscapeOrientation; + break; default: - attribute = Qt::WA_Maemo5AutoOrientation; + case ScreenOrientationAuto: + attribute = Qt::WA_AutoOrientation; break; - } +#endif // QT_VERSION < 0x040702 + }; setAttribute(attribute, true); -#else // Q_OS_SYMBIAN - Q_UNUSED(orientation); -#endif // Q_OS_SYMBIAN } void QmlApplicationViewer::showExpanded() { #ifdef Q_OS_SYMBIAN showFullScreen(); -#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) +#elif defined(Q_WS_MAEMO_5) showMaximized(); #else show(); diff --git a/examples/serviceframework/dialer/qmlapplicationviewer/qmlapplicationviewer.h b/examples/serviceframework/dialer/qmlapplicationviewer/qmlapplicationviewer.h index 3a21e826..19e209a9 100644 --- a/examples/serviceframework/dialer/qmlapplicationviewer/qmlapplicationviewer.h +++ b/examples/serviceframework/dialer/qmlapplicationviewer/qmlapplicationviewer.h @@ -1,4 +1,4 @@ -// checksum 0x5a59 version 0x2000a +// checksum 0x382f version 0x4000b /* This file was generated by the Qt Quick Application wizard of Qt Creator. QmlApplicationViewer is a convenience class containing mobile device specific @@ -11,7 +11,11 @@ #ifndef QMLAPPLICATIONVIEWER_H #define QMLAPPLICATIONVIEWER_H +#ifndef QT_QUICK1 #include <QtQuick1/QDeclarativeView> +#else +#include <QtDeclarative/QDeclarativeView> +#endif class QmlApplicationViewer : public QDeclarativeView { @@ -29,7 +33,10 @@ public: void setMainQmlFile(const QString &file); void addImportPath(const QString &path); + + // Note that this will only have an effect on Symbian and Fremantle. void setOrientation(ScreenOrientation orientation); + void showExpanded(); private: diff --git a/examples/serviceframework/dialer/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/serviceframework/dialer/qmlapplicationviewer/qmlapplicationviewer.pri index 1c0c7edb..b07f8736 100644 --- a/examples/serviceframework/dialer/qmlapplicationviewer/qmlapplicationviewer.pri +++ b/examples/serviceframework/dialer/qmlapplicationviewer/qmlapplicationviewer.pri @@ -1,4 +1,4 @@ -# checksum 0x3dc8 version 0x2000a +# checksum 0xcaf1 version 0x4000b # This file was generated by the Qt Quick Application wizard of Qt Creator. # The code below adds the QmlApplicationViewer to the project and handles the # activation of QML debugging. @@ -11,51 +11,11 @@ SOURCES += $$PWD/qmlapplicationviewer.cpp HEADERS += $$PWD/qmlapplicationviewer.h INCLUDEPATH += $$PWD -defineTest(minQtVersion) { - maj = $$1 - min = $$2 - patch = $$3 - isEqual(QT_MAJOR_VERSION, $$maj) { - isEqual(QT_MINOR_VERSION, $$min) { - isEqual(QT_PATCH_VERSION, $$patch) { - return(true) - } - greaterThan(QT_PATCH_VERSION, $$patch) { - return(true) - } - } - greaterThan(QT_MINOR_VERSION, $$min) { - return(true) - } - } - return(false) -} - -contains(DEFINES, QMLJSDEBUGGER) { - CONFIG(debug, debug|release) { - !minQtVersion(4, 7, 1) { - warning() - warning("Disabling QML debugging:") - warning() - warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") - warning("This library requires Qt 4.7.1 or newer.") - warning() - DEFINES -= QMLJSDEBUGGER - } else:isEmpty(QMLJSDEBUGGER_PATH) { - warning() - warning("Disabling QML debugging:") - warning() - warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") - warning("Please specify its location on the qmake command line, eg") - warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") - warning() - DEFINES -= QMLJSDEBUGGER - } else { - include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) - } - } else { - DEFINES -= QMLJSDEBUGGER - } +# Include JS debugger library if QMLJSDEBUGGER_PATH is set +!isEmpty(QMLJSDEBUGGER_PATH) { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) +} else { + DEFINES -= QMLJSDEBUGGER } # This file was generated by an application wizard of Qt Creator. # The code below handles deployment to Symbian and Maemo, aswell as copying @@ -78,19 +38,30 @@ for(deploymentfolder, DEPLOYMENTFOLDERS) { MAINPROFILEPWD = $$PWD symbian { - ICON = $${TARGET}.svg - TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 - contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone - contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices + isEmpty(ICON):exists($${TARGET}.svg):ICON = $${TARGET}.svg + isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 } else:win32 { - !isEqual(PWD,$$OUT_PWD) { - copyCommand = @echo Copying application data... - for(deploymentfolder, DEPLOYMENTFOLDERS) { - source = $$eval($${deploymentfolder}.source) - pathSegments = $$split(source, /) - sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) - copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, /, \\) + sourcePathSegments = $$split(source, \\) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments) + target = $$replace(target, /, \\) + !isEqual(source,$$target) { + !isEmpty(copyCommand):copyCommand += && + isEqual(QMAKE_DIR_SEP, \\) { + copyCommand += $(COPY_DIR) \"$$source\" \"$$target\" + } else { + source = $$replace(source, \\\\, /) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + target = $$replace(target, \\\\, /) + copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\" + } } + } + !isEmpty(copyCommand) { + copyCommand = @echo Copying application data... && $$copyCommand copydeploymentfolders.commands = $$copyCommand first.depends = $(first) copydeploymentfolders export(first.depends) @@ -99,22 +70,29 @@ symbian { } } else:unix { maemo5 { - installPrefix = /opt/usr - desktopfile.path = /usr/share/applications/hildon + desktopfile.path = /usr/share/applications/hildon } else { - installPrefix = /usr/local desktopfile.path = /usr/share/applications - !isEqual(PWD,$$OUT_PWD) { - copyCommand = @echo Copying application data... - for(deploymentfolder, DEPLOYMENTFOLDERS) { - macx { - target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) - } else { - target = $$OUT_PWD/$$eval($${deploymentfolder}.target) - } - copyCommand += && $(MKDIR) $$target - copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, \\\\, /) + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) } + target = $$replace(target, \\\\, /) + sourcePathSegments = $$split(source, /) + targetFullPath = $$target/$$last(sourcePathSegments) + !isEqual(source,$$targetFullPath) { + !isEmpty(copyCommand):copyCommand += && + copyCommand += $(MKDIR) \"$$target\" + copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\" + } + } + !isEmpty(copyCommand) { + copyCommand = @echo Copying application data... && $$copyCommand copydeploymentfolders.commands = $$copyCommand first.depends = $(first) copydeploymentfolders export(first.depends) @@ -122,12 +100,13 @@ symbian { QMAKE_EXTRA_TARGETS += first copydeploymentfolders } } + installPrefix = /opt/$${TARGET} for(deploymentfolder, DEPLOYMENTFOLDERS) { item = item$${deploymentfolder} itemfiles = $${item}.files $$itemfiles = $$eval($${deploymentfolder}.source) itempath = $${item}.path - $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target) export($$itemfiles) export($$itempath) INSTALLS += $$item |