| 1 |
/* Copyright (C) 2016 - 2017 Dan Chapman <[email protected]> |
| 2 |
|
| 3 |
This file is part of Dekko email client for Ubuntu devices |
| 4 |
|
| 5 |
This program is free software; you can redistribute it and/or |
| 6 |
modify it under the terms of the GNU General Public License as |
| 7 |
published by the Free Software Foundation; either version 2 of |
| 8 |
the License or (at your option) version 3 |
| 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.4 |
| 19 |
import Lomiri.Components 1.3 |
| 20 |
|
| 21 |
Item { |
| 22 |
id: viewState |
| 23 |
anchors.fill: parent |
| 24 |
|
| 25 |
readonly property real gu40: units.gu(40) |
| 26 |
readonly property real gu50: units.gu(50) |
| 27 |
readonly property real gu90: units.gu(90) |
| 28 |
// These 2 aren't the exact values but 5gu less as it looks a little better |
| 29 |
readonly property real gu130: units.gu(125) // gu90 + gu40 |
| 30 |
readonly property real gu140: units.gu(135) // gu90 + gu50 |
| 31 |
readonly property bool isSmallFF: state === "small" |
| 32 |
readonly property bool isMediumFF: state === "medium" |
| 33 |
readonly property bool isLargeFF: state === "large" |
| 34 |
// This is possibly a bit dumb but it should do the job :-/ |
| 35 |
readonly property bool isLandscape: height < width |
| 36 |
|
| 37 |
states: [ |
| 38 |
// Phone/tablet (portrait) |
| 39 |
State { |
| 40 |
name: "small" |
| 41 |
when: width <= gu90 |
| 42 |
}, |
| 43 |
// tablet (landscape) |
| 44 |
State { |
| 45 |
name: "medium" |
| 46 |
when: width > gu90 && width <= gu140 |
| 47 |
}, |
| 48 |
// Laptop/Desktop size screen |
| 49 |
State { |
| 50 |
name: "large" |
| 51 |
when: width > gu140 |
| 52 |
} |
| 53 |
] |
| 54 |
} |