on xenial help sign in
make it rotate
5f8acb0Michael Zanetti
qml/DisabledScreenNotice.qml+64−30
@@ -17,53 +17,87 @@
17import QtQuick 2.4
17import QtQuick 2.4
18import QtQuick.Layouts 1.1
18import QtQuick.Layouts 1.1
19import Ubuntu.Components 1.3
19import Ubuntu.Components 1.3
20+import QtQuick.Window 2.2
20import "Components"
21import "Components"
22+import "Rotation"
21
23
22−Image {
24+Item {
23 id: root
25 id: root
24
26
25 property bool infoNoteDisplayed: true
27 property bool infoNoteDisplayed: true
26
28
29+ property int physicalOrientation: Screen.orientation
30+
27 WallpaperResolver {
31 WallpaperResolver {
28 width: root.width
32 width: root.width
29 id: wallpaperResolver
33 id: wallpaperResolver
30 }
34 }
31
35
32− source: wallpaperResolver.background
36+ Item {
33−
37+ id: contentContainer
34−
35− VirtualTouchPad {
36− anchors.fill: parent
38+ anchors.centerIn: parent
37− }
39+ height: rotationAngle == 90 || rotationAngle == 270 ? parent.width : parent.height
40+ width: rotationAngle == 90 || rotationAngle == 270 ? parent.height : parent.width
38
41
39− MouseArea {
42+ property int rotationAngle: {
40− objectName: "infoNoticeMouseArea"
43+ print("changed something", Screen.orientation)
44+ switch (Screen.orientation) {
45+ case Qt.PortraitOrientation:
46+ return 0;
47+ case Qt.LandscapeOrientation:
48+ return 270;
49+ case Qt.InvertedPortraitOrientation:
50+ return 180;
51+ case Qt.InvertedLandscapeOrientation:
52+ return 90;
53+ }
54+ }
55+
56+ transform: Rotation {
57+ origin.x: contentContainer.width / 2
58+ origin.y: contentContainer.height / 2; axis { x: 0; y: 0; z: 1 }
59+ angle: contentContainer.rotationAngle
60+ }
61+
62+ VirtualTouchPad {
41− anchors.fill: parent
63+ anchors.fill: parent
42− opacity: infoNoteDisplayed ? 1 : 0
43− visible: opacity > 0
44− enabled: visible
45− Behavior on opacity {
46− UbuntuNumberAnimation { }
47 }
64 }
48
65
49− onClicked: root.infoNoteDisplayed = false;
66+ Image {
50−
51− Rectangle {
52 anchors.fill: parent
67 anchors.fill: parent
53− color: "black"
68+ source: wallpaperResolver.background
54− opacity: 0.4
55 }
69 }
56
70
71+ MouseArea {
72+ objectName: "infoNoticeMouseArea"
73+ anchors.fill: parent
74+ opacity: infoNoteDisplayed ? 1 : 0
75+ visible: opacity > 0
76+ enabled: visible
77+ Behavior on opacity {
78+ UbuntuNumberAnimation { }
79+ }
80+
81+ onClicked: root.infoNoteDisplayed = false;
82+
83+ Rectangle {
84+ anchors.fill: parent
85+ color: "black"
86+ opacity: 0.4
87+ }
88+
57− Label {
89+ Label {
58− id: text
90+ id: text
59− anchors.centerIn: parent
91+ anchors.centerIn: parent
60− width: parent.width - units.gu(8)
92+ width: parent.width - units.gu(8)
61− text: i18n.tr("Your device is now connected to an external display. Use this screen as a touch pad to interact with the mouse.")
93+ text: i18n.tr("Your device is now connected to an external display. Use this screen as a touch pad to interact with the mouse.")
62− color: "white"
94+ color: "white"
63− horizontalAlignment: Text.AlignHCenter
95+ horizontalAlignment: Text.AlignHCenter
64− verticalAlignment: Text.AlignVCenter
96+ verticalAlignment: Text.AlignVCenter
65− fontSize: "x-large"
97+ fontSize: "x-large"
66− wrapMode: Text.Wrap
98+ wrapMode: Text.Wrap
99+ }
67 }
100 }
68 }
101 }
69}
102}
103+