diff options
author | aavit <eirik.aavitsland@digia.com> | 2014-01-17 10:04:40 +0100 |
---|---|---|
committer | aavit <eirik.aavitsland@digia.com> | 2014-01-17 10:06:10 +0100 |
commit | 4e6b5d1c692bdcacdbf09955af67fc930c9a35a5 (patch) | |
tree | 3dc00ed63e88301f1c4ebeaeb353cca69f2103cb /src/utils | |
parent | 5980f4bff613e109375d3d841b2891847011074d (diff) | |
parent | 59649939d06664d722046cd54e0933c5b402e9a9 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/doc/src/b2qt.qdoc
Change-Id: I9d345dcc689e751b997df797ce12b6cd8a14ffb9
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/qdroidutils.cpp | 40 | ||||
-rw-r--r-- | src/utils/qdroidutils.h | 27 | ||||
-rw-r--r-- | src/utils/utils.pro | 2 |
3 files changed, 68 insertions, 1 deletions
diff --git a/src/utils/qdroidutils.cpp b/src/utils/qdroidutils.cpp index 81a50ed..67d8d29 100644 --- a/src/utils/qdroidutils.cpp +++ b/src/utils/qdroidutils.cpp @@ -1,3 +1,21 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of Qt Enterprise Embedded. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** the contact form at http://qt.digia.com/ +** +****************************************************************************/ #include "qdroidutils.h" #include <unistd.h> #include <QDebug> @@ -46,6 +64,28 @@ void QDroidUtils::powerOffSystem() qWarning("powerOff returned"); } +void QDroidUtils::setOrientationForAudioSystem(AudioOrientation orientation) +{ +#ifdef Q_OS_ANDROID_NO_SDK + QString orientationString = QStringLiteral("undefined"); + switch (orientation) { + case LandscapeAudioOrientation: + orientationString = QStringLiteral("landscape"); + break; + case PortraitAudioOrientation: + orientationString = QStringLiteral("portrait"); + break; + case SquareAudioOrientation: + orientationString = QStringLiteral("square"); + break; + default: + break; + } + android::AudioSystem::setParameters(0, android::String8(QStringLiteral("orientation=%2") + .arg(orientationString).toLatin1().constData())); +#endif +} + /*! * Sets the master volume to \a volume. * The volume can range from 0 to 100 and is linear. diff --git a/src/utils/qdroidutils.h b/src/utils/qdroidutils.h index 339a529..9d833bb 100644 --- a/src/utils/qdroidutils.h +++ b/src/utils/qdroidutils.h @@ -1,3 +1,21 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of Qt Enterprise Embedded. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** the contact form at http://qt.digia.com/ +** +****************************************************************************/ #ifndef QDROIDUTILS_H #define QDROIDUTILS_H @@ -8,6 +26,13 @@ class Q_DECL_EXPORT QDroidUtils : public QObject Q_OBJECT Q_ENUMS(AudioStreamType) public: + enum AudioOrientation { + LandscapeAudioOrientation, + PortraitAudioOrientation, + SquareAudioOrientation, + UndefinedAudioOrientation, + }; + enum AudioStreamType { DefaultAudioStream = -1, VoiceCallAudioStream = 0, @@ -36,6 +61,8 @@ public Q_SLOTS: void rebootSystem(); void powerOffSystem(); + void setOrientationForAudioSystem(AudioOrientation orientation); + void setMasterVolume(int volume); void setMasterMute(bool mute); void setStreamVolume(AudioStreamType stream, int volume); diff --git a/src/utils/utils.pro b/src/utils/utils.pro index 5711337..a15231f 100644 --- a/src/utils/utils.pro +++ b/src/utils/utils.pro @@ -11,7 +11,7 @@ QT = core network MODULE = droidutils load(qt_module) -android: LIBS += -lmedia -lhardware -lcutils +android: LIBS += -lmedia -lhardware -lcutils -lutils HEADERS += \ $$PWD/qdroidutils.h |