2 * Copyright 2015 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 // Just because "native" is a reserved keyword :(
23 property int native_: Qt.PortraitOrientation
25 property int primary: Qt.PortraitOrientation
27 property int landscape: Qt.LandscapeOrientation
28 property int invertedLandscape: Qt.InvertedLandscapeOrientation
29 property int portrait: Qt.PortraitOrientation
30 property int invertedPortrait: Qt.InvertedPortraitOrientation
32 function map(orientations) {
35 if (orientations & Qt.PortraitOrientation) {
36 result |= root.portrait;
39 if (orientations & Qt.InvertedPortraitOrientation) {
40 result |= root.invertedPortrait;
43 if (orientations & Qt.LandscapeOrientation) {
44 result |= root.landscape;
47 if (orientations & Qt.InvertedLandscapeOrientation) {
48 result |= root.invertedLandscape;
52 result = root.primary;