Commit 0f875c5a authored by Chupligin Sergey's avatar Chupligin Sergey Committed by Sergey Chupligin

[Notifications] Fixup some warnings in qml and set Lockscreen notify

configurable
parent 5a825cb4
......@@ -24,6 +24,12 @@ Image {
defaultValue: "/usr/share/lipstick-glacier-home-qt5/qml/images/graphics-wallpaper-home.jpg"
}
ConfigurationValue{
id: showNotifiBody
key: "/home/glacier/lockScreen/showNotifiBody"
defaultValue: false
}
LockscreenClock {
id: clock
anchors {
......@@ -276,20 +282,19 @@ Image {
}
clip:true
delegate: NotificationItem {
height: Theme.itemHeightLarge
height: (showNotifiBody.value) ? Theme.itemHeightExtraLarge : Theme.itemHeightLarge
enabled:DeviceLock.state !== DeviceLock.Locked
scale: notificationColumn.opacity
transformOrigin: Item.Left
iconSize: Theme.itemHeightMedium
appName.font.pixelSize: Theme.fontSizeSmall
appName.visible: DeviceLock.state !== DeviceLock.Locked
appName.anchors.verticalCenter: labelColumn.verticalCenter
appName.anchors.verticalCenter: parent.verticalCenter
appBody.font.pixelSize: Theme.fontSizeTiny
appBody.visible: false
appBody.visible: showNotifiBody.value
appTimestamp.visible: false
appSummary.visible: false
appSummary.visible: showNotifiBody.value
pressBg.visible: DeviceLock.state !== DeviceLock.Locked
pressBg.opacity: 0.3
pressBg.opacity: 0.5
}
}
}
......@@ -2,35 +2,52 @@ import QtQuick 2.6
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
MouseArea {
Item {
id: notifyArea
height: Theme.itemHeightExtraLarge
width: parent.width
height: Theme.itemHeightExtraLarge
width: parent.width-Theme.itemSpacingSmall*2
anchors{
left: parent.left
leftMargin: Theme.itemSpacingSmall
}
property alias appIcon: appIcon
property alias appBody: appBody
property alias appName: appName
property alias appSummary: appSummary
property alias labelColumn: labelColumn
property alias appTimestamp: appTimestamp
property alias pressBg: pressBg
property int iconSize:Math.min(Theme.iconSizeLauncher, height-Theme.itemSpacingMedium)
property string timeAgo
property int swipeTreshold: notifyArea.width/3
drag.target: modelData.userRemovable ? notifyArea : null
drag.axis: Drag.XAxis
drag.minimumX: -notifyArea.width
drag.maximumX: notifyArea.width
drag.onActiveChanged: {
if(!drag.active ) {
if((notifyArea.x > swipeTreshold)) {
MouseArea{
id: notifyMouseArea
anchors.fill: parent
drag.target: modelData.userRemovable ? notifyArea : null
drag.axis: Drag.XAxis
drag.minimumX: -notifyArea.width
drag.maximumX: notifyArea.width
drag.onActiveChanged: {
if(!drag.active ) {
if((notifyArea.x > swipeTreshold)) {
slideAnimation.start()
}else if (notifyArea.x < -swipeTreshold){
slideReverseAnimation.start()
} else {
slideBackAnimation.start()
}
}
}
onClicked: {
if (modelData.userRemovable) {
slideAnimation.start()
}else if (notifyArea.x < -swipeTreshold){
slideReverseAnimation.start()
} else {
slideBackAnimation.start()
modelData.actionInvoked("default")
}
}
}
......@@ -78,13 +95,6 @@ MouseArea {
}
}
onClicked: {
if (modelData.userRemovable) {
slideAnimation.start()
} else {
modelData.actionInvoked("default")
}
}
NumberAnimation {
id:slideAnimation
target: notifyArea
......@@ -119,9 +129,23 @@ MouseArea {
id:pressBg
anchors.fill: parent
color: Theme.fillColor
visible: notifyArea.pressed
visible: notifyMouseArea.pressed
radius: Theme.itemSpacingMedium
opacity: 0.5
}
Rectangle{
id: progressBar
width: parent.width*modelData.progress
height: parent.height
color: Theme.accentColor
radius: Theme.itemSpacingMedium
opacity: 0.1
opacity: 0.75
anchors{
top: parent.top
left: parent.left
}
visible: modelData.hasProgress
}
Image {
......@@ -155,65 +179,67 @@ MouseArea {
}
}
}
Column {
id:labelColumn
Label {
id: appName
text: modelData.appName
width: Math.min(implicitWidth, parent.width-appTimestamp.width-Theme.itemSpacingSmall)
color: Theme.textColor
elide: Text.ElideRight
font.pixelSize: Theme.fontSizeSmall
anchors {
left:appIcon.right
leftMargin: Theme.itemSpacingLarge
verticalCenter: appIcon.verticalCenter
}
height: parent.height
width: parent.width-appIcon.width-Theme.itemSpacingLarge*2
Label {
id: appName
text: modelData.appName
width: Math.min(implicitWidth, parent.width-appTimestamp.width-Theme.itemSpacingSmall)
color: Theme.textColor
elide: Text.ElideRight
font.pixelSize: Theme.fontSizeSmall
anchors {
left: parent.left
}
left: appIcon.right
leftMargin: Theme.itemSpacingSmall
top: parent.top
topMargin: Theme.itemSpacingSmall
}
Label {
id:appTimestamp
color: Theme.textColor
font.pixelSize: Theme.fontSizeTiny
text: if(timeAgo) timeAgo
horizontalAlignment: Text.AlignRight
anchors {
verticalCenter: appName.verticalCenter
rightMargin: Theme.itemSpacingSmall
right:labelColumn.right
}
Component.onCompleted: refreshTimestamp()
}
Label {
id:appTimestamp
color: Theme.textColor
font.pixelSize: Theme.fontSizeTiny
text: if(timeAgo) timeAgo
horizontalAlignment: Text.AlignRight
anchors {
top: parent.top
topMargin: Theme.itemSpacingSmall
right:parent.right
rightMargin: Theme.itemSpacingSmall
}
Component.onCompleted: refreshTimestamp()
}
Label {
id: appSummary
text: modelData.summary || modelData.previewSummary
width: parent.width-Theme.itemSpacingHuge
color: Theme.textColor
font.pixelSize: Theme.fontSizeTiny
anchors{
left: parent.left
}
maximumLineCount: 1
elide: Text.ElideRight
Label {
id: appSummary
text: modelData.summary || modelData.previewSummary
width: parent.width-Theme.itemSpacingHuge
color: Theme.textColor
font.pixelSize: Theme.fontSizeTiny
anchors{
left: appIcon.right
leftMargin: Theme.itemSpacingSmall
top: appName.bottom
topMargin: Theme.itemSpacingSmall
}
maximumLineCount: 1
elide: Text.ElideRight
}
Label {
id: appBody
width: parent.width-Theme.itemSpacingHuge
text: modelData.body || modelData.previewBody
color: Theme.textColor
font.pixelSize: Theme.fontSizeTiny
anchors{
left: parent.left
}
maximumLineCount: 1
elide: Text.ElideRight
Label {
id: appBody
width: parent.width-Theme.itemSpacingHuge
text: modelData.body || modelData.previewBody
color: Theme.textColor
font.pixelSize: Theme.fontSizeTiny
anchors{
left: appIcon.right
leftMargin: Theme.itemSpacingSmall
top: appSummary.bottom
topMargin: Theme.itemSpacingSmall
}
maximumLineCount: 1
elide: Text.ElideRight
}
}
{
"path": "notifications",
"category": "Personalization",
"title": "Notifications"
}
/*
* Copyright (C) 2018 Chupligin Sergey <neochapay@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
import QtQuick 2.6
import QtQuick.Controls 1.0
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
import org.nemomobile.configuration 1.0
import "../../components"
Page {
id: notifySettingsPage
headerTools: HeaderToolsLayout { showBackButton: true; title: qsTr("Notifications")}
ConfigurationValue{
id: showNotifiBody
key: "/home/glacier/lockScreen/showNotifiBody"
defaultValue: false
}
SettingsColumn{
id: showNotifiBodySettings
Rectangle{
id: showNotifiBodyArea
width: parent.width
height: childrenRect.height
color: "transparent"
Label{
id: showNotifiBodyLabel
text: qsTr("Show notification body on lockscreen");
anchors{
left: parent.left
top: parent.top
}
width: parent.width-showNotifiBodyCheck.width
wrapMode: Text.WordWrap
}
CheckBox{
id: showNotifiBodyCheck
checked: showNotifiBody.value
anchors{
right: parent.right
verticalCenter: showNotifiBodyLabel.verticalCenter
}
onClicked: showNotifiBody.value = checked
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M912 1696q0-16-16-16-59 0-101.5-42.5t-42.5-101.5q0-16-16-16t-16 16q0 73 51.5 124.5t124.5 51.5q16 0 16-16zm816-288q0 52-38 90t-90 38h-448q0 106-75 181t-181 75-181-75-75-181h-448q-52 0-90-38t-38-90q50-42 91-88t85-119.5 74.5-158.5 50-206 19.5-260q0-152 117-282.5t307-158.5q-8-19-8-39 0-40 28-68t68-28 68 28 28 68q0 20-8 39 190 28 307 158.5t117 282.5q0 139 19.5 260t50 206 74.5 158.5 85 119.5 91 88z" fill="#fff"/></svg>
\ No newline at end of file
......@@ -83,13 +83,20 @@ statusbar.files = qml/statusbar/BatteryPanel.qml\
qml/statusbar/NumButton.qml \
qml/statusbar/MediaController.qml
settingsplugin.files = settings-plugins/wallpaper/wallpaper.qml \
settingswallpaperplugin.files = settings-plugins/wallpaper/wallpaper.qml \
settings-plugins/wallpaper/selectImage.qml \
settings-plugins/wallpaper/wallpaper.svg
settingsplugin.path = /usr/share/glacier-settings/qml/plugins/wallpaper
settingswallpaperplugin.path = /usr/share/glacier-settings/qml/plugins/wallpaper
settingsnotificationsplugin.files = settings-plugins/notifications/notifications.qml \
settings-plugins/notifications/notifications.svg
settingsnotificationsplugin.path = /usr/share/glacier-settings/qml/plugins/notifications
settingspluginconfig.files = settings-plugins/wallpaper/wallpaper.json \
settings-plugins/notifications/notifications.json
settingspluginconfig.files = settings-plugins/wallpaper/wallpaper.json
settingspluginconfig.path = /usr/share/glacier-settings/plugins
INSTALLS += styles \
......@@ -103,7 +110,8 @@ INSTALLS += styles \
connectivity\
notifications\
statusbar\
settingsplugin\
settingswallpaperplugin\
settingsnotificationsplugin\
settingspluginconfig
CONFIG += qt link_pkgconfig
......@@ -158,4 +166,7 @@ DISTFILES += \
i18n/glacer-home.ts \
qml/connectivity/ConnectionSelector.qml \
qml/statusbar/BatteryIndicator.qml \
settings-plugins/wallpaper/selectImage.qml
settings-plugins/wallpaper/selectImage.qml \
settings-plugins/notifications/notifications.json \
settings-plugins/notifications/notifications.svg \
settings-plugins/notifications/notifications.qml
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