Commit e9cf4e0e authored by Christian Kandeler's avatar Christian Kandeler
Browse files

QML Wizard: Orientation support for Maemo5.

Reviewed-by: Alessandro Portale
parent 891be16a
...@@ -70,8 +70,8 @@ void QmlApplicationViewer::addImportPath(const QString &path) ...@@ -70,8 +70,8 @@ void QmlApplicationViewer::addImportPath(const QString &path)
void QmlApplicationViewer::setOrientation(Orientation orientation) void QmlApplicationViewer::setOrientation(Orientation orientation)
{ {
#ifdef Q_OS_SYMBIAN
if (orientation != Auto) { if (orientation != Auto) {
#if defined(Q_OS_SYMBIAN)
#if defined(ORIENTATIONLOCK) #if defined(ORIENTATIONLOCK)
const CAknAppUiBase::TAppUiOrientation uiOrientation = const CAknAppUiBase::TAppUiOrientation uiOrientation =
(orientation == LockPortrait) ? CAknAppUi::EAppUiOrientationPortrait (orientation == LockPortrait) ? CAknAppUi::EAppUiOrientationPortrait
...@@ -84,8 +84,25 @@ void QmlApplicationViewer::setOrientation(Orientation orientation) ...@@ -84,8 +84,25 @@ void QmlApplicationViewer::setOrientation(Orientation orientation)
#else // ORIENTATIONLOCK #else // ORIENTATIONLOCK
qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation.");
#endif // ORIENTATIONLOCK #endif // ORIENTATIONLOCK
#endif // Q_OS_SYMBIAN
} }
#elif defined(Q_WS_MAEMO_5)
Qt::WidgetAttribute attribute;
switch (orientation) {
case LockPortrait:
attribute = Qt::WA_Maemo5PortraitOrientation;
break;
case LockLandscape:
attribute = Qt::WA_Maemo5LandscapeOrientation;
break;
case Auto:
default:
attribute = Qt::WA_Maemo5AutoOrientation;
break;
}
setAttribute(attribute, true);
#else // Q_OS_SYMBIAN
Q_UNUSED(orientation);
#endif // Q_OS_SYMBIAN
} }
void QmlApplicationViewer::setLoadDummyData(bool loadDummyData) void QmlApplicationViewer::setLoadDummyData(bool loadDummyData)
......
...@@ -344,12 +344,20 @@ QByteArray QmlStandaloneApp::generateMainCpp(const QString *errorMessage) const ...@@ -344,12 +344,20 @@ QByteArray QmlStandaloneApp::generateMainCpp(const QString *errorMessage) const
else else
line = insertParameter(line, QLatin1Char('"') + path(ModulesDir) + QLatin1Char('"')); line = insertParameter(line, QLatin1Char('"') + path(ModulesDir) + QLatin1Char('"'));
} else if (line.contains(QLatin1String("// ORIENTATION"))) { } else if (line.contains(QLatin1String("// ORIENTATION"))) {
if (m_orientation == Auto) const char *orientationString;
continue; switch (m_orientation) {
else case LockLandscape:
line = insertParameter(line, QLatin1String("QmlApplicationView::") orientationString = "LockLandscape";
+ QLatin1String(m_orientation == LockLandscape ? break;
"LockLandscape" : "LockPortrait")); case LockPortrait:
orientationString = "LockPortrait";
break;
case Auto:
orientationString = "Auto";
break;
}
line = insertParameter(line, QLatin1String("QmlApplicationViewer::")
+ QLatin1String(orientationString));
} else if (line.contains(QLatin1String("// LOADDUMMYDATA"))) { } else if (line.contains(QLatin1String("// LOADDUMMYDATA"))) {
continue; continue;
} }
...@@ -656,8 +664,8 @@ static QList<GeneratedFileInfo> updateableFiles(const QString &mainProFile) ...@@ -656,8 +664,8 @@ static QList<GeneratedFileInfo> updateableFiles(const QString &mainProFile)
QString fileName; QString fileName;
} files[] = { } files[] = {
{GeneratedFileInfo::AppViewerPriFile, appViewerPriFileName}, {GeneratedFileInfo::AppViewerPriFile, appViewerPriFileName},
{GeneratedFileInfo::AppViewerHFile, appViewerCppFileName}, {GeneratedFileInfo::AppViewerHFile, appViewerHFileName},
{GeneratedFileInfo::AppViewerCppFile, appViewerHFileName} {GeneratedFileInfo::AppViewerCppFile, appViewerCppFileName}
}; };
const QFileInfo mainProFileInfo(mainProFile); const QFileInfo mainProFileInfo(mainProFile);
const int size = sizeof(files) / sizeof(files[0]); const int size = sizeof(files) / sizeof(files[0]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment