Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
glacier-home
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NemoMobile
glacier-home
Commits
d6ce9ea7
Commit
d6ce9ea7
authored
Mar 30, 2014
by
Simonas Leleiva
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2 from locusf/nb_717
[glacierui] Notification previews
parents
840397f9
628961c6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
222 additions
and
2 deletions
+222
-2
NotificationPreview.qml
src/qml/NotificationPreview.qml
+219
-0
resources-qml.qrc
src/resources-qml.qrc
+1
-0
src.pro
src/src.pro
+2
-2
No files found.
src/qml/NotificationPreview.qml
0 → 100644
View file @
d6ce9ea7
// This file is part of colorful-home, a nice user experience for touchscreens.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// Copyright (C) 2012 Jolla Ltd.
// Contact: Vesa Halttunen <vesa.halttunen@jollamobile.com>
import
QtQuick
2.0
//import org.freedesktop.contextkit 1.0
import
org
.
nemomobile
.
lipstick
0.1
Item
{
id
:
notificationWindow
property
alias
summary
:
summary
.
text
property
alias
body
:
body
.
text
property
alias
icon
:
icon
.
source
width
:
initialSize
.
width
height
:
initialSize
.
height
/*
TODO
ContextProperty {
id: orientationAngleContextProperty
key: "/Screen/CurrentWindow/OrientationAngle"
}
*/
QtObject
{
id
:
orientationAngleContextProperty
property
int
value
:
0
}
MouseArea
{
id
:
notificationArea
property
bool
isPortrait
:
(
orientationAngleContextProperty
.
value
==
90
||
orientationAngleContextProperty
.
value
==
270
)
property
int
notificationHeight
:
102
property
int
notificationMargin
:
14
property
int
notificationIconSize
:
60
anchors.top
:
parent
.
top
anchors.left
:
parent
.
left
width
:
isPortrait
?
notificationWindow
.
height
:
notificationWindow
.
width
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
"
)
Rectangle
{
id
:
notificationPreview
anchors
{
fill
:
parent
margins
:
10
}
color
:
"
black
"
radius
:
5
border
{
color
:
"
gray
"
width
:
2
}
opacity
:
0
states
:
[
State
{
name
:
"
show
"
PropertyChanges
{
target
:
notificationPreview
opacity
:
1
}
StateChangeScript
{
name
:
"
notificationShown
"
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
()
}
}
},
State
{
name
:
"
hide
"
PropertyChanges
{
target
:
notificationPreview
opacity
:
0
}
StateChangeScript
{
name
:
"
notificationHidden
"
script
:
{
notificationTimer
.
stop
()
notificationPreviewPresenter
.
showNextNotification
()
}
}
}
]
transitions
:
[
Transition
{
to
:
"
show
"
SequentialAnimation
{
NumberAnimation
{
property
:
"
opacity
"
;
duration
:
200
}
ScriptAction
{
scriptName
:
"
notificationShown
"
}
}
},
Transition
{
to
:
"
hide
"
SequentialAnimation
{
NumberAnimation
{
property
:
"
opacity
"
;
duration
:
200
}
ScriptAction
{
scriptName
:
"
notificationHidden
"
}
}
}
]
Timer
{
id
:
notificationTimer
interval
:
3000
repeat
:
false
onTriggered
:
notificationPreview
.
state
=
"
hide
"
}
Image
{
id
:
icon
anchors
{
top
:
parent
.
top
left
:
parent
.
left
topMargin
:
notificationArea
.
notificationMargin
-
3
leftMargin
:
notificationArea
.
notificationMargin
}
width
:
notificationArea
.
notificationIconSize
height
:
width
source
:
{
var
icon
=
""
if
(
notificationPreviewPresenter
.
notification
!=
null
)
{
icon
=
notificationPreviewPresenter
.
notification
.
previewIcon
?
notificationPreviewPresenter
.
notification
.
previewIcon
:
notificationPreviewPresenter
.
notification
.
icon
if
(
icon
)
{
icon
=
((
icon
.
indexOf
(
"
/
"
)
==
0
?
"
file://
"
:
"
image://theme/
"
)
+
icon
)
}
}
icon
}
}
Text
{
id
:
summary
anchors
{
top
:
parent
.
top
left
:
icon
.
right
right
:
parent
.
right
topMargin
:
notificationArea
.
notificationMargin
leftMargin
:
notificationArea
.
notificationMargin
+
26
rightMargin
:
notificationArea
.
notificationMargin
}
font
{
pixelSize
:
22
}
text
:
notificationPreviewPresenter
.
notification
!=
null
?
notificationPreviewPresenter
.
notification
.
previewSummary
:
""
color
:
"
white
"
clip
:
true
elide
:
Text
.
ElideRight
}
Text
{
id
:
body
anchors
{
top
:
summary
.
bottom
left
:
summary
.
left
right
:
summary
.
right
}
font
{
pixelSize
:
22
}
text
:
notificationPreviewPresenter
.
notification
!=
null
?
notificationPreviewPresenter
.
notification
.
previewBody
:
""
color
:
"
white
"
clip
:
true
elide
:
Text
.
ElideRight
}
Connections
{
target
:
notificationPreviewPresenter
;
onNotificationChanged
:
notificationPreview
.
state
=
(
notificationPreviewPresenter
.
notification
!=
null
)
?
"
show
"
:
"
hide
"
}
}
}
}
src/resources-qml.qrc
View file @
d6ce9ea7
...
...
@@ -32,5 +32,6 @@
<file>qml/images/battery6.png</file>
<file>qml/compositor/WindowWrapperMystic.qml</file>
<file>qml/theme/icon-m-framework-close-thumbnail.png</file>
<file>qml/NotificationPreview.qml</file>
</qresource>
</RCC>
src/src.pro
View file @
d6ce9ea7
...
...
@@ -11,7 +11,6 @@ config.files = lipstick.conf
config
.
path
=
/
usr
/
share
/
lipstick
INSTALLS
+=
config
CONFIG
+=
qt
link_pkgconfig
QT
+=
quick
...
...
@@ -39,6 +38,7 @@ OTHER_FILES += qml/*.qml \
qml/compositor/WindowWrapperMystic.qml \
qml/compositor/WindowWrapperBase.qml \
qml/compositor/WindowWrapperAlpha.qml \
qml/compositor/ScreenGestureArea.qml
qml/compositor/ScreenGestureArea.qml \
qml/NotificationPreview.qml
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment