on xenial help sign in
make it rotate
commit5f8acb008f22620bb0b21cd021a7a5b21145ba2a authorMichael Zanetti <michael.zanetti@canonical.com> dateMon 18 Jan 2016, 14:54 (11 years ago) parentd2e52c2
1 file changed+64−30
qml/DisabledScreenNotice.qml+64−30
qml/DisabledScreenNotice.qml+64−30
@@ -17,53 +17,87 @@
1717import QtQuick 2.4
1818import QtQuick.Layouts 1.1
1919import Ubuntu.Components 1.3
20+import QtQuick.Window 2.2
2021import "Components"
22+import "Rotation"
2123
22−Image {
24+Item {
2325 id: root
2426
2527 property bool infoNoteDisplayed: true
2628
29+ property int physicalOrientation: Screen.orientation
30+
2731 WallpaperResolver {
2832 width: root.width
2933 id: wallpaperResolver
3034 }
3135
32− source: wallpaperResolver.background
33−
34−
35− VirtualTouchPad {
36− anchors.fill: parent
37− }
36+ Item {
37+ id: contentContainer
38+ anchors.centerIn: parent
39+ height: rotationAngle == 90 || rotationAngle == 270 ? parent.width : parent.height
40+ width: rotationAngle == 90 || rotationAngle == 270 ? parent.height : parent.width
3841
39− MouseArea {
40− objectName: "infoNoticeMouseArea"
41− anchors.fill: parent
42− opacity: infoNoteDisplayed ? 1 : 0
43− visible: opacity > 0
44− enabled: visible
45− Behavior on opacity {
46− UbuntuNumberAnimation { }
42+ property int rotationAngle: {
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 {
63+ anchors.fill: parent
4764 }
4865
49− onClicked: root.infoNoteDisplayed = false;
50−
51− Rectangle {
66+ Image {
5267 anchors.fill: parent
53− color: "black"
54− opacity: 0.4
68+ source: wallpaperResolver.background
5569 }
5670
57− Label {
58− id: text
59− anchors.centerIn: parent
60− 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.")
62− color: "white"
63− horizontalAlignment: Text.AlignHCenter
64− verticalAlignment: Text.AlignVCenter
65− fontSize: "x-large"
66− wrapMode: Text.Wrap
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+
89+ Label {
90+ id: text
91+ anchors.centerIn: parent
92+ width: parent.width - units.gu(8)
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.")
94+ color: "white"
95+ horizontalAlignment: Text.AlignHCenter
96+ verticalAlignment: Text.AlignVCenter
97+ fontSize: "x-large"
98+ wrapMode: Text.Wrap
99+ }
67100 }
68101 }
69102}
103+