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)
void QmlApplicationViewer::setOrientation(Orientation orientation)
{
#ifdef Q_OS_SYMBIAN
if (orientation != Auto) {
#if defined(Q_OS_SYMBIAN)
#if defined(ORIENTATIONLOCK)
const CAknAppUiBase::TAppUiOrientation uiOrientation =
(orientation == LockPortrait) ? CAknAppUi::EAppUiOrientationPortrait
......@@ -84,8 +84,25 @@ void QmlApplicationViewer::setOrientation(Orientation orientation)
#else // ORIENTATIONLOCK
qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation.");
#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)
......
......@@ -344,12 +344,20 @@ QByteArray QmlStandaloneApp::generateMainCpp(const QString *errorMessage) const
else
line = insertParameter(line, QLatin1Char('"') + path(ModulesDir) + QLatin1Char('"'));
} else if (line.contains(QLatin1String("// ORIENTATION"))) {
if (m_orientation == Auto)
continue;
else
line = insertParameter(line, QLatin1String("QmlApplicationView::")
+ QLatin1String(m_orientation == LockLandscape ?
"LockLandscape" : "LockPortrait"));
const char *orientationString;
switch (m_orientation) {
case LockLandscape:
orientationString = "LockLandscape";
break;
case LockPortrait:
orientationString = "LockPortrait";
break;
case Auto:
orientationString = "Auto";
break;
}
line = insertParameter(line, QLatin1String("QmlApplicationViewer::")
+ QLatin1String(orientationString));
} else if (line.contains(QLatin1String("// LOADDUMMYDATA"))) {
continue;
}
......@@ -656,8 +664,8 @@ static QList<GeneratedFileInfo> updateableFiles(const QString &mainProFile)
QString fileName;
} files[] = {
{GeneratedFileInfo::AppViewerPriFile, appViewerPriFileName},
{GeneratedFileInfo::AppViewerHFile, appViewerCppFileName},
{GeneratedFileInfo::AppViewerCppFile, appViewerHFileName}
{GeneratedFileInfo::AppViewerHFile, appViewerHFileName},
{GeneratedFileInfo::AppViewerCppFile, appViewerCppFileName}
};
const QFileInfo mainProFileInfo(mainProFile);
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