diff --git a/share/qtcreator/templates/mobileapp/app.pro b/share/qtcreator/templates/mobileapp/app.pro index ec826e61e60..5c1eacc1144 100644 --- a/share/qtcreator/templates/mobileapp/app.pro +++ b/share/qtcreator/templates/mobileapp/app.pro @@ -4,10 +4,6 @@ # dir1.source = mydir DEPLOYMENTFOLDERS = # file1 dir1 -# Avoid auto screen rotation -# ORIENTATIONLOCK # -DEFINES += ORIENTATIONLOCK - # TARGETUID3 # symbian:TARGET.UID3 = 0xE1111234 diff --git a/share/qtcreator/templates/mobileapp/mainwindow.cpp b/share/qtcreator/templates/mobileapp/mainwindow.cpp index aad030d8aa1..e719b5f9169 100644 --- a/share/qtcreator/templates/mobileapp/mainwindow.cpp +++ b/share/qtcreator/templates/mobileapp/mainwindow.cpp @@ -11,13 +11,6 @@ #include -#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) -#include -#include -#include -#include -#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK - MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { @@ -31,40 +24,45 @@ MainWindow::~MainWindow() void MainWindow::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 (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(128); break; case ScreenOrientationLockLandscape: - attribute = Qt::WA_Maemo5LandscapeOrientation; + attribute = static_cast(129); break; - case ScreenOrientationAuto: default: - attribute = Qt::WA_Maemo5AutoOrientation; + case ScreenOrientationAuto: + attribute = static_cast(130); break; - } +#else // QT_VERSION < 0x040702 + case ScreenOrientationLockPortrait: + attribute = Qt::WA_LockPortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_LockLandscapeOrientation; + break; + default: + 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 MainWindow::showExpanded() diff --git a/share/qtcreator/templates/qmlapp/app.pro b/share/qtcreator/templates/qmlapp/app.pro index cc8c3346451..1ba2bce8235 100644 --- a/share/qtcreator/templates/qmlapp/app.pro +++ b/share/qtcreator/templates/qmlapp/app.pro @@ -9,10 +9,6 @@ DEPLOYMENTFOLDERS = folder_01 # QML_IMPORT_PATH # QML_IMPORT_PATH = -# Avoid auto screen rotation -# ORIENTATIONLOCK # -DEFINES += ORIENTATIONLOCK - # TARGETUID3 # symbian:TARGET.UID3 = 0xE1111234 diff --git a/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.cpp b/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.cpp index 59d9750edd6..4298aa74671 100644 --- a/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.cpp +++ b/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -27,13 +27,6 @@ #include #endif -#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) -#include -#include -#include -#include -#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK - #if defined(QMLJSDEBUGGER) // Enable debugging before any QDeclarativeEngine is created @@ -108,40 +101,45 @@ 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 (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(128); break; case ScreenOrientationLockLandscape: - attribute = Qt::WA_Maemo5LandscapeOrientation; + attribute = static_cast(129); break; - case ScreenOrientationAuto: default: - attribute = Qt::WA_Maemo5AutoOrientation; + case ScreenOrientationAuto: + attribute = static_cast(130); break; - } +#else // QT_VERSION < 0x040702 + case ScreenOrientationLockPortrait: + attribute = Qt::WA_LockPortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_LockLandscapeOrientation; + break; + default: + 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() diff --git a/share/qtcreator/templates/shared/deployment.pri b/share/qtcreator/templates/shared/deployment.pri index c225424f199..10c36f748a4 100644 --- a/share/qtcreator/templates/shared/deployment.pri +++ b/share/qtcreator/templates/shared/deployment.pri @@ -21,7 +21,6 @@ MAINPROFILEPWD = $$PWD symbian { isEmpty(ICON):exists($${TARGET}.svg):ICON = $${TARGET}.svg isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 - contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone } else:win32 { copyCommand = for(deploymentfolder, DEPLOYMENTFOLDERS) { diff --git a/src/plugins/qt4projectmanager/wizards/abstractmobileapp.cpp b/src/plugins/qt4projectmanager/wizards/abstractmobileapp.cpp index aa88ef1fb63..212c2555fb5 100644 --- a/src/plugins/qt4projectmanager/wizards/abstractmobileapp.cpp +++ b/src/plugins/qt4projectmanager/wizards/abstractmobileapp.cpp @@ -262,9 +262,6 @@ QByteArray AbstractMobileApp::generateProFile(QString *errorMessage) const while (!(line = in.readLine()).isNull()) { if (line.contains(QLatin1String("# TARGETUID3"))) { valueOnNextLine = symbianTargetUid(); - } else if (line.contains(QLatin1String("# ORIENTATIONLOCK")) - && orientation() == ScreenOrientationAuto) { - uncommentNextLine = true; } else if (line.contains(QLatin1String("# NETWORKACCESS")) && !networkEnabled()) { uncommentNextLine = true;