Commit 17859efd authored by Aleksi Suomalainen's avatar Aleksi Suomalainen

Merge pull request #33 from filippz/master

Cleanup and fix notification position
parents 623057c3 80f05568
...@@ -9,7 +9,7 @@ Name: lipstick-glacier-home-qt5 ...@@ -9,7 +9,7 @@ Name: lipstick-glacier-home-qt5
# << macros # << macros
Summary: A nice homescreen for Glacier experience Summary: A nice homescreen for Glacier experience
Version: 0.18 Version: 0.19
Release: 1 Release: 1
Group: System/GUI/Other Group: System/GUI/Other
License: BSD License: BSD
......
Name: lipstick-glacier-home-qt5 Name: lipstick-glacier-home-qt5
Summary: A nice homescreen for Glacier experience Summary: A nice homescreen for Glacier experience
Version: 0.18 Version: 0.19
Release: 1 Release: 1
Group: System/GUI/Other Group: System/GUI/Other
License: BSD License: BSD
......
...@@ -23,62 +23,30 @@ ...@@ -23,62 +23,30 @@
// Contact: Vesa Halttunen <vesa.halttunen@jollamobile.com> // Contact: Vesa Halttunen <vesa.halttunen@jollamobile.com>
import QtQuick 2.0 import QtQuick 2.0
//import org.freedesktop.contextkit 1.0
import org.nemomobile.lipstick 0.1 import org.nemomobile.lipstick 0.1
import "../scripts/desktop.js" as Desktop
Item { Item {
id: notificationWindow id: notificationWindow
property alias summary: summary.text property alias summary: summary.text
property alias body: body.text property alias body: body.text
property alias icon: icon.source property alias icon: icon.source
width: initialSize.width width: Desktop.instance.parent.width
height: initialSize.height height: Desktop.instance.parent.height
rotation: Desktop.instance.parent.rotation
/* x: Desktop.instance.parent.x
TODO y: Desktop.instance.parent.y
ContextProperty {
id: orientationAngleContextProperty
key: "/Screen/CurrentWindow/OrientationAngle"
}
*/
QtObject {
id: orientationAngleContextProperty
property int value: 0
}
MouseArea { MouseArea {
id: notificationArea id: notificationArea
property bool isPortrait: (orientationAngleContextProperty.value == 90 || orientationAngleContextProperty.value == 270)
property int notificationHeight: 102 property int notificationHeight: 102
property int notificationMargin: 14 property int notificationMargin: 14
property int notificationIconSize: 60 property int notificationIconSize: 60
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: 48 anchors.bottomMargin: 48
anchors.left: parent.left anchors.left: parent.left
width: isPortrait ? notificationWindow.height : notificationWindow.width width: notificationWindow.width
height: notificationArea.notificationHeight height: notificationArea.notificationHeight
transform: Rotation {
origin.x: { switch(orientationAngleContextProperty.value) {
case 270:
return notificationWindow.height / 2
case 180:
case 90:
return notificationWindow.width / 2
default:
return 0
} }
origin.y: { switch(orientationAngleContextProperty.value) {
case 270:
case 180:
return notificationWindow.height / 2
case 90:
return notificationWindow.width / 2
default:
return 0
} }
angle: (orientationAngleContextProperty.value === undefined || orientationAngleContextProperty.value == 0) ? 0 : -360 + orientationAngleContextProperty.value
}
onClicked: if (notificationPreviewPresenter.notification != null) notificationPreviewPresenter.notification.actionInvoked("default") onClicked: if (notificationPreviewPresenter.notification != null) notificationPreviewPresenter.notification.actionInvoked("default")
...@@ -102,9 +70,6 @@ Item { ...@@ -102,9 +70,6 @@ Item {
StateChangeScript { StateChangeScript {
name: "notificationShown" name: "notificationShown"
script: { script: {
var topLeft = notificationPreview.mapToItem(notificationWindow, 0, 0)
var bottomRight = notificationPreview.mapToItem(notificationWindow, notificationPreview.width, notificationPreview.height)
notificationPreviewPresenter.setNotificationPreviewRect(topLeft.x, topLeft.y, bottomRight.x, bottomRight.y)
notificationTimer.start() notificationTimer.start()
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment