|
| 1 | +/* |
| 2 | + * QML Air - A lightweight and mostly flat UI widget collection for QML |
| 3 | + * Copyright (C) 2014 Michael Spencer |
| 4 | + * |
| 5 | + * This program is free software: you can redistribute it and/or modify |
| 6 | + * it under the terms of the GNU General Public License as published by |
| 7 | + * the Free Software Foundation, either version 3 of the License, or |
| 8 | + * (at your option) any later version. |
| 9 | + * |
| 10 | + * This program is distributed in the hope that it will be useful, |
| 11 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | + * GNU General Public License for more details. |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU General Public License |
| 16 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | + */ |
| 18 | +import QtQuick 2.0 |
| 19 | +import QtQuick.Window 2.0 |
| 20 | + |
| 21 | +Item { |
| 22 | + id: app |
| 23 | + |
| 24 | + //opacity: 0.5 |
| 25 | + |
| 26 | + width: units.gu(120) |
| 27 | + height: units.gu(80) |
| 28 | + |
| 29 | + default property alias content: contents.data |
| 30 | + |
| 31 | + property alias theme: __theme |
| 32 | + |
| 33 | + Theme { |
| 34 | + id: __theme |
| 35 | + } |
| 36 | + |
| 37 | + property alias units: __units |
| 38 | + |
| 39 | + property real scale: Screen.pixelDensity * 1.2// pixels/mm |
| 40 | + |
| 41 | + property alias device: __device |
| 42 | + |
| 43 | + QtObject { |
| 44 | + id: __device |
| 45 | + |
| 46 | + property string mode: "desktop" |
| 47 | + } |
| 48 | + |
| 49 | + property alias animations: __animations |
| 50 | + |
| 51 | + QtObject { |
| 52 | + id: __animations |
| 53 | + |
| 54 | + property int pageTransition: 250 |
| 55 | + } |
| 56 | + |
| 57 | + QtObject { |
| 58 | + id: __units |
| 59 | + |
| 60 | + function mm(number) { |
| 61 | + return number * scale |
| 62 | + } |
| 63 | + |
| 64 | + function dp(number) { |
| 65 | + return number * scale * 0.15 |
| 66 | + } |
| 67 | + |
| 68 | + function gu(number) { |
| 69 | + return dp(number * 8) |
| 70 | + } |
| 71 | + } |
| 72 | + |
| 73 | + property alias i18n: __i18n |
| 74 | + |
| 75 | + QtObject { |
| 76 | + id: __i18n |
| 77 | + |
| 78 | + function tr(text) { |
| 79 | + return text |
| 80 | + } |
| 81 | + } |
| 82 | + |
| 83 | + Rectangle { |
| 84 | + id: contents |
| 85 | + anchors { |
| 86 | + left: parent.left |
| 87 | + right: parent.right |
| 88 | + top: parent.top |
| 89 | + bottom: parent.bottom |
| 90 | + } |
| 91 | + |
| 92 | + color: theme.defaultBackground |
| 93 | + |
| 94 | + Rectangle { |
| 95 | + id: overlay |
| 96 | + anchors.fill: parent |
| 97 | + color: "black" |
| 98 | + opacity: drawer && drawer.showing ? 0.4 : 0 |
| 99 | + visible: opacity > 0 |
| 100 | + z: 10 |
| 101 | + |
| 102 | + MouseArea { |
| 103 | + anchors.fill: parent |
| 104 | + onClicked: drawer.close() |
| 105 | + } |
| 106 | + } |
| 107 | + } |
| 108 | + |
| 109 | + property NavigationDrawer drawer |
| 110 | +} |
0 commit comments