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 { ...@@ -24,6 +24,12 @@ Image {
defaultValue: "/usr/share/lipstick-glacier-home-qt5/qml/images/graphics-wallpaper-home.jpg" defaultValue: "/usr/share/lipstick-glacier-home-qt5/qml/images/graphics-wallpaper-home.jpg"
} }
ConfigurationValue{
id: showNotifiBody
key: "/home/glacier/lockScreen/showNotifiBody"
defaultValue: false
}
LockscreenClock { LockscreenClock {
id: clock id: clock
anchors { anchors {
...@@ -276,20 +282,19 @@ Image { ...@@ -276,20 +282,19 @@ Image {
} }
clip:true clip:true
delegate: NotificationItem { delegate: NotificationItem {
height: Theme.itemHeightLarge height: (showNotifiBody.value) ? Theme.itemHeightExtraLarge : Theme.itemHeightLarge
enabled:DeviceLock.state !== DeviceLock.Locked enabled:DeviceLock.state !== DeviceLock.Locked
scale: notificationColumn.opacity scale: notificationColumn.opacity
transformOrigin: Item.Left transformOrigin: Item.Left
iconSize: Theme.itemHeightMedium
appName.font.pixelSize: Theme.fontSizeSmall appName.font.pixelSize: Theme.fontSizeSmall
appName.visible: DeviceLock.state !== DeviceLock.Locked appName.visible: DeviceLock.state !== DeviceLock.Locked
appName.anchors.verticalCenter: labelColumn.verticalCenter appName.anchors.verticalCenter: parent.verticalCenter
appBody.font.pixelSize: Theme.fontSizeTiny appBody.font.pixelSize: Theme.fontSizeTiny
appBody.visible: false appBody.visible: showNotifiBody.value
appTimestamp.visible: false appTimestamp.visible: false
appSummary.visible: false appSummary.visible: showNotifiBody.value
pressBg.visible: DeviceLock.state !== DeviceLock.Locked pressBg.visible: DeviceLock.state !== DeviceLock.Locked
pressBg.opacity: 0.3 pressBg.opacity: 0.5
} }
} }
} }
...@@ -2,23 +2,31 @@ import QtQuick 2.6 ...@@ -2,23 +2,31 @@ import QtQuick 2.6
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
MouseArea { Item {
id: notifyArea id: notifyArea
height: Theme.itemHeightExtraLarge height: Theme.itemHeightExtraLarge
width: parent.width width: parent.width-Theme.itemSpacingSmall*2
anchors{
left: parent.left
leftMargin: Theme.itemSpacingSmall
}
property alias appIcon: appIcon property alias appIcon: appIcon
property alias appBody: appBody property alias appBody: appBody
property alias appName: appName property alias appName: appName
property alias appSummary: appSummary property alias appSummary: appSummary
property alias labelColumn: labelColumn
property alias appTimestamp: appTimestamp property alias appTimestamp: appTimestamp
property alias pressBg: pressBg property alias pressBg: pressBg
property int iconSize:Math.min(Theme.iconSizeLauncher, height-Theme.itemSpacingMedium) property int iconSize:Math.min(Theme.iconSizeLauncher, height-Theme.itemSpacingMedium)
property string timeAgo property string timeAgo
property int swipeTreshold: notifyArea.width/3 property int swipeTreshold: notifyArea.width/3
MouseArea{
id: notifyMouseArea
anchors.fill: parent
drag.target: modelData.userRemovable ? notifyArea : null drag.target: modelData.userRemovable ? notifyArea : null
drag.axis: Drag.XAxis drag.axis: Drag.XAxis
drag.minimumX: -notifyArea.width drag.minimumX: -notifyArea.width
...@@ -35,6 +43,15 @@ MouseArea { ...@@ -35,6 +43,15 @@ MouseArea {
} }
} }
onClicked: {
if (modelData.userRemovable) {
slideAnimation.start()
} else {
modelData.actionInvoked("default")
}
}
}
function refreshTimestamp() { function refreshTimestamp() {
var seconds = Math.floor((new Date() - modelData.timestamp) / 1000) var seconds = Math.floor((new Date() - modelData.timestamp) / 1000)
var years = Math.floor(seconds / (365*24*60*60)) var years = Math.floor(seconds / (365*24*60*60))
...@@ -78,13 +95,6 @@ MouseArea { ...@@ -78,13 +95,6 @@ MouseArea {
} }
} }
onClicked: {
if (modelData.userRemovable) {
slideAnimation.start()
} else {
modelData.actionInvoked("default")
}
}
NumberAnimation { NumberAnimation {
id:slideAnimation id:slideAnimation
target: notifyArea target: notifyArea
...@@ -119,9 +129,23 @@ MouseArea { ...@@ -119,9 +129,23 @@ MouseArea {
id:pressBg id:pressBg
anchors.fill: parent anchors.fill: parent
color: Theme.fillColor 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 radius: Theme.itemSpacingMedium
opacity: 0.1 opacity: 0.75
anchors{
top: parent.top
left: parent.left
}
visible: modelData.hasProgress
} }
Image { Image {
...@@ -155,15 +179,6 @@ MouseArea { ...@@ -155,15 +179,6 @@ MouseArea {
} }
} }
} }
Column {
id:labelColumn
anchors {
left:appIcon.right
leftMargin: Theme.itemSpacingLarge
verticalCenter: appIcon.verticalCenter
}
height: parent.height
width: parent.width-appIcon.width-Theme.itemSpacingLarge*2
Label { Label {
id: appName id: appName
...@@ -173,9 +188,13 @@ MouseArea { ...@@ -173,9 +188,13 @@ MouseArea {
elide: Text.ElideRight elide: Text.ElideRight
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
anchors { anchors {
left: parent.left left: appIcon.right
leftMargin: Theme.itemSpacingSmall
top: parent.top
topMargin: Theme.itemSpacingSmall
} }
} }
Label { Label {
id:appTimestamp id:appTimestamp
color: Theme.textColor color: Theme.textColor
...@@ -183,9 +202,11 @@ MouseArea { ...@@ -183,9 +202,11 @@ MouseArea {
text: if(timeAgo) timeAgo text: if(timeAgo) timeAgo
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
anchors { anchors {
verticalCenter: appName.verticalCenter top: parent.top
topMargin: Theme.itemSpacingSmall
right:parent.right
rightMargin: Theme.itemSpacingSmall rightMargin: Theme.itemSpacingSmall
right:labelColumn.right
} }
Component.onCompleted: refreshTimestamp() Component.onCompleted: refreshTimestamp()
} }
...@@ -197,7 +218,10 @@ MouseArea { ...@@ -197,7 +218,10 @@ MouseArea {
color: Theme.textColor color: Theme.textColor
font.pixelSize: Theme.fontSizeTiny font.pixelSize: Theme.fontSizeTiny
anchors{ anchors{
left: parent.left left: appIcon.right
leftMargin: Theme.itemSpacingSmall
top: appName.bottom
topMargin: Theme.itemSpacingSmall
} }
maximumLineCount: 1 maximumLineCount: 1
elide: Text.ElideRight elide: Text.ElideRight
...@@ -210,10 +234,12 @@ MouseArea { ...@@ -210,10 +234,12 @@ MouseArea {
color: Theme.textColor color: Theme.textColor
font.pixelSize: Theme.fontSizeTiny font.pixelSize: Theme.fontSizeTiny
anchors{ anchors{
left: parent.left left: appIcon.right
leftMargin: Theme.itemSpacingSmall
top: appSummary.bottom
topMargin: Theme.itemSpacingSmall
} }
maximumLineCount: 1 maximumLineCount: 1
elide: Text.ElideRight 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\ ...@@ -83,13 +83,20 @@ statusbar.files = qml/statusbar/BatteryPanel.qml\
qml/statusbar/NumButton.qml \ qml/statusbar/NumButton.qml \
qml/statusbar/MediaController.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/selectImage.qml \
settings-plugins/wallpaper/wallpaper.svg 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 settingspluginconfig.path = /usr/share/glacier-settings/plugins
INSTALLS += styles \ INSTALLS += styles \
...@@ -103,7 +110,8 @@ INSTALLS += styles \ ...@@ -103,7 +110,8 @@ INSTALLS += styles \
connectivity\ connectivity\
notifications\ notifications\
statusbar\ statusbar\
settingsplugin\ settingswallpaperplugin\
settingsnotificationsplugin\
settingspluginconfig settingspluginconfig
CONFIG += qt link_pkgconfig CONFIG += qt link_pkgconfig
...@@ -158,4 +166,7 @@ DISTFILES += \ ...@@ -158,4 +166,7 @@ DISTFILES += \
i18n/glacer-home.ts \ i18n/glacer-home.ts \
qml/connectivity/ConnectionSelector.qml \ qml/connectivity/ConnectionSelector.qml \
qml/statusbar/BatteryIndicator.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