Commit a15c1f82 authored by Chupligin Sergey's avatar Chupligin Sergey Committed by GitHub

Merge pull request #64 from eekkelund/master

[Scaling][Notification][Search] Fix scaling to use newly calculated Theme.sizes
parents 354a94dd 32b7b3bd
...@@ -41,7 +41,7 @@ GridView { ...@@ -41,7 +41,7 @@ GridView {
property alias deleter: deleter property alias deleter: deleter
property var switcher: null property var switcher: null
property string searchString property string searchString
property int minCellSize: Theme.iconSizeLauncher + Theme.itemSpacingHuge property int minCellSize: Theme.iconSizeLauncher + Theme.iconSizeLauncher/2
property int rows: Math.floor(parent.height / minCellSize) property int rows: Math.floor(parent.height / minCellSize)
property int columns: Math.floor(parent.width / minCellSize) property int columns: Math.floor(parent.width / minCellSize)
...@@ -55,7 +55,7 @@ GridView { ...@@ -55,7 +55,7 @@ GridView {
clip: true clip: true
onContentYChanged: { onContentYChanged: {
if( contentY < -140 ) { if( contentY < -Theme.itemHeightHuge*2 ) {
headerItem.visible = true; headerItem.visible = true;
timer.running = true; timer.running = true;
} }
......
...@@ -74,7 +74,7 @@ Item { ...@@ -74,7 +74,7 @@ Item {
Flickable { Flickable {
id: flickable id: flickable
contentHeight: gridview.height contentHeight: gridview.height
width: closeMode ? parent.width - Theme.itemSpacingLarge : parent.width // see comment re right anchor below width: closeMode ? parent.width - Theme.itemSpacingLarge : parent.width - Theme.itemSpacingSmall // see comment re right anchor below
MouseArea { MouseArea {
height: flickable.contentHeight > flickable.height ? flickable.contentHeight : flickable.height height: flickable.contentHeight > flickable.height ? flickable.contentHeight : flickable.height
width: flickable.width width: flickable.width
...@@ -88,17 +88,17 @@ Item { ...@@ -88,17 +88,17 @@ Item {
anchors { anchors {
top: parent.top top: parent.top
topMargin: closeMode ? Theme.itemSpacingLarge : 0 topMargin: closeMode ? Theme.itemSpacingLarge : Theme.itemSpacingSmall
bottom: toolBar.top bottom: toolBar.top
left: parent.left left: parent.left
// no right anchor to avoid double margin (complicated math) // no right anchor to avoid double margin (complicated math)
leftMargin: closeMode ? Theme.itemSpacingLarge : 0 leftMargin: closeMode ? Theme.itemSpacingLarge : Theme.itemSpacingSmall
} }
Grid { Grid {
id: gridview id: gridview
columns: 2 columns: 2
spacing: closeMode ? Theme.itemSpacingLarge : 0 spacing: closeMode ? Theme.itemSpacingLarge : Theme.itemSpacingSmall
move: Transition { move: Transition {
NumberAnimation { NumberAnimation {
properties: "x,y" properties: "x,y"
...@@ -159,17 +159,9 @@ Item { ...@@ -159,17 +159,9 @@ Item {
closeMode = false closeMode = false
} }
} }
Rectangle { Item {
id: toolBar id: toolBar
color: Theme.backgroundColor
border {
width: 1
color: Theme.fillDarkColor
}
z: 202
height:Theme.itemHeightExtraLarge + 2*padding
property int padding: Theme.itemSpacingSmall property int padding: Theme.itemSpacingSmall
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
...@@ -177,8 +169,20 @@ Item { ...@@ -177,8 +169,20 @@ Item {
margins: -1 margins: -1
bottomMargin: switcherRoot.closeMode ? statusbar.height : -height bottomMargin: switcherRoot.closeMode ? statusbar.height : -height
} }
Behavior on anchors.bottomMargin { PropertyAnimation { duration: 100 } } Behavior on anchors.bottomMargin { PropertyAnimation { duration: 100 } }
z: 202
height:Theme.itemHeightLarge + 2 * toolBar.padding
Rectangle {
anchors.fill: parent
color: Theme.fillDarkColor
opacity: 0.3
border {
width: size.ratio(1)
color: Theme.backgroundColor
}
}
Row { Row {
anchors { anchors {
top: parent.top top: parent.top
...@@ -187,7 +191,7 @@ Item { ...@@ -187,7 +191,7 @@ Item {
left: parent.left left: parent.left
bottom: parent.bottom bottom: parent.bottom
} }
spacing: toolBar.padding*2 spacing: toolBar.padding * 2
Button { Button {
id: toolBarDone id: toolBarDone
...@@ -200,20 +204,6 @@ Item { ...@@ -200,20 +204,6 @@ Item {
switcherRoot.closeMode = false; switcherRoot.closeMode = false;
} }
text: qsTr("Done") text: qsTr("Done")
//Untill fontSizes are fixed
style: ButtonStyle {
label: Text {
renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: control.text
color: Theme.textColor
font.family: Theme.fontFamily
font.pixelSize: Theme.fontSizeMedium
font.weight: control.primary ? Theme.fontWeightLarge : Theme.fontWeightMedium
opacity: control.enabled ? 1.0 : 0.3
}
}
} }
Button { Button {
...@@ -222,7 +212,7 @@ Item { ...@@ -222,7 +212,7 @@ Item {
top: parent.top top: parent.top
bottom: parent.bottom bottom: parent.bottom
} }
width: parent.width / 2 - toolBar.padding width: parent.width / 2 - toolBar.padding
onClicked: { onClicked: {
// TODO: use close animation inside item // TODO: use close animation inside item
for (var i = gridRepeater.count - 1; i >= 0; i--) { for (var i = gridRepeater.count - 1; i >= 0; i--) {
...@@ -230,20 +220,7 @@ Item { ...@@ -230,20 +220,7 @@ Item {
} }
} }
text: qsTr("Close All") text: qsTr("Close All")
//Untill fontSizes are fixed primary: true
style: ButtonStyle {
label: Text {
renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: control.text
color: Theme.textColor
font.family: Theme.fontFamily
font.pixelSize: Theme.fontSizeMedium
font.weight: control.primary ? Theme.fontWeightLarge : Theme.fontWeightMedium
opacity: control.enabled ? 1.0 : 0.3
}
}
} }
} }
} }
......
...@@ -60,7 +60,6 @@ Flickable { ...@@ -60,7 +60,6 @@ Flickable {
text: Qt.formatDateTime(wallClock.time, "dddd") text: Qt.formatDateTime(wallClock.time, "dddd")
color: Theme.textColor color: Theme.textColor
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Bold
anchors { anchors {
top: parent.top top: parent.top
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
...@@ -81,22 +80,35 @@ Flickable { ...@@ -81,22 +80,35 @@ Flickable {
} }
} }
} }
Timer {
id: timestampTimer
interval: 60000
running: true
repeat: true
}
Column { Column {
id: notificationColumn id: notificationColumn
width: parent.width width: parent.width
anchors{ anchors{
top: daterow.bottom top: daterow.bottom
topMargin: Theme.itemSpacingHuge topMargin: Theme.itemHeightLarge*1.5
} }
spacing: Theme.itemSpacingHuge spacing: Theme.itemSpacingExtraSmall
Repeater { Repeater {
model: NotificationListModel { model: NotificationListModel {
id: notifmodel id: notifmodel
} }
delegate: NotificationItem{} delegate: NotificationItem{
id: notifItem
Connections {
target: timestampTimer
onTriggered: notifItem.refreshTimestamp()
onRunningChanged: if (timestampTimer.running) notifItem.refreshTimestamp()
}
} }
} }
} }
}
} }
...@@ -89,8 +89,8 @@ Item { ...@@ -89,8 +89,8 @@ Item {
Spinner { Spinner {
id: spinnerr id: spinnerr
anchors.centerIn: iconImage anchors.centerIn: iconImage
width: iconWrapper.width width: height
height: width height: parent.height - Theme.itemSpacingHuge
enabled: (modelData.object.type === LauncherModel.Application) ? modelData.object.isLaunching ? switcher.switchModel.getWindowIdForTitle(modelData.object.title) == 0 : false : false enabled: (modelData.object.type === LauncherModel.Application) ? modelData.object.isLaunching ? switcher.switchModel.getWindowIdForTitle(modelData.object.title) == 0 : false : false
Connections { Connections {
......
...@@ -80,24 +80,28 @@ Image { ...@@ -80,24 +80,28 @@ Image {
right:parent.right right:parent.right
rightMargin: Theme.itemSpacingLarge rightMargin: Theme.itemSpacingLarge
} }
interactive:false interactive:DeviceLock.state !== DeviceLock.Locked
spacing: 0 spacing: Theme.itemSpacingExtraSmall
model: NotificationListModel { model: NotificationListModel {
id: notifmodel id: notifmodel
} }
clip:true
delegate: NotificationItem { delegate: NotificationItem {
height: 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 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: appIcon.verticalCenter appName.anchors.verticalCenter: labelColumn.verticalCenter
appName.anchors.top: null
appBody.font.pixelSize: Theme.fontSizeTiny appBody.font.pixelSize: Theme.fontSizeTiny
appBody.visible: false appBody.visible: false
appTimestamp.visible: false
appSummary.visible: false appSummary.visible: false
pressBg.visible: DeviceLock.state !== DeviceLock.Locked
pressBg.opacity: 0.3
} }
} }
} }
...@@ -54,7 +54,6 @@ Rectangle { ...@@ -54,7 +54,6 @@ Rectangle {
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: Theme.textColor color: Theme.textColor
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
font.weight: Font.Bold
anchors { anchors {
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
} }
......
...@@ -35,6 +35,7 @@ import QtQuick.Controls.Styles.Nemo 1.0 ...@@ -35,6 +35,7 @@ import QtQuick.Controls.Styles.Nemo 1.0
import org.nemomobile.contacts 1.0 import org.nemomobile.contacts 1.0
Item { Item {
id:rootItem
height: (searchField.text.length > 0 ? listView.height+searchField.height : searchField.height) + (visible ? Theme.itemSpacingHuge + margin.height : 0) height: (searchField.text.length > 0 ? listView.height+searchField.height : searchField.height) + (visible ? Theme.itemSpacingHuge + margin.height : 0)
visible: false visible: false
anchors.bottomMargin:Theme.itemSpacingHuge anchors.bottomMargin:Theme.itemSpacingHuge
...@@ -48,8 +49,10 @@ Item { ...@@ -48,8 +49,10 @@ Item {
onVisibleChanged: { onVisibleChanged: {
if( visible) searchField.focus = true if( visible){
else searchField.focus = false searchField.focus = true
searchField.forceActiveFocus()
} else searchField.focus = false
oldHeight=height oldHeight=height
} }
...@@ -68,25 +71,30 @@ Item { ...@@ -68,25 +71,30 @@ Item {
rightMargin: Theme.itemSpacingMedium rightMargin: Theme.itemSpacingMedium
bottomMargin:Theme.itemSpacingHuge bottomMargin:Theme.itemSpacingHuge
} }
Image { Image {
id:searchIcon id:searchIcon
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width:height width:height
height: searchField.height height: searchField.height
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
source: "image://theme/search" source: "image://theme/search"
} }
TextField { TextField {
id:searchField id:searchField
width:parent.width - searchIcon.width - Theme.itemSpacingMedium width:parent.width - searchIcon.width - Theme.itemSpacingMedium
placeholderText: qsTr("Search") placeholderText: qsTr("Search")
Binding { Binding {
target: gridview target: gridview
property: "searchString" property: "searchString"
value: searchField.text.toLowerCase().trim() value: searchField.text.toLowerCase().trim()
}
onTextChanged: {
if(tex.lenght>0) {
searchField.forceActiveFocus()
}
}
} }
}
} }
ListView { ListView {
...@@ -180,7 +188,13 @@ Item { ...@@ -180,7 +188,13 @@ Item {
var titles = [] var titles = []
var contacts = [] var contacts = []
for (i = 0; i < searchLauncherModel.itemCount; ++i) { for (i = 0; i < searchLauncherModel.itemCount; ++i) {
titles.push({'iconTitle':searchLauncherModel.get(i).title, 'iconSource':searchLauncherModel.get(i).iconId, 'id':i, 'category':qsTr("Application")}) if (searchLauncherModel.get(i).type === LauncherModel.Folder) {
for(var j = 0; j< searchLauncherModel.get(i).itemCount; ++j ) {
titles.push({'iconTitle':searchLauncherModel.get(i).get(j).title, 'iconSource':searchLauncherModel.get(i).get(j).iconId, 'id':i, 'folderId':j, 'category':qsTr("Application")})
}
} else {
titles.push({'iconTitle':searchLauncherModel.get(i).title, 'iconSource':searchLauncherModel.get(i).iconId, 'id':i, 'folderId':-1, 'category':qsTr("Application")})
}
} }
for (i = 0; i < peopleModel.count; ++i) { for (i = 0; i < peopleModel.count; ++i) {
if(peopleModel.get(i).firstName && peopleModel.get(i).lastName) { if(peopleModel.get(i).firstName && peopleModel.get(i).lastName) {
...@@ -217,11 +231,12 @@ Item { ...@@ -217,11 +231,12 @@ Item {
iconTitle = filteredTitles[i].iconTitle iconTitle = filteredTitles[i].iconTitle
iconId = filteredTitles[i].iconSource iconId = filteredTitles[i].iconSource
var id = filteredTitles[i].id var id = filteredTitles[i].id
var folderId = filteredTitles[i].folderId
category = filteredTitles[i].category category = filteredTitles[i].category
found = existingTitleObject.hasOwnProperty(iconTitle) found = existingTitleObject.hasOwnProperty(iconTitle)
if (!found) { if (!found) {
// for simplicity, just adding to end instead of corresponding position in original list // for simplicity, just adding to end instead of corresponding position in original list
listModel.append({'title':iconTitle, 'iconSource':iconId, 'id':id, 'category':category}) listModel.append({'title':iconTitle, 'iconSource':iconId, 'id':id, 'folderId':folderId, 'category':category})
} }
} }
for (i = 0; i < contacts.length; ++i) { for (i = 0; i < contacts.length; ++i) {
...@@ -273,13 +288,19 @@ Item { ...@@ -273,13 +288,19 @@ Item {
id: spinner id: spinner
anchors { anchors {
centerIn: iconImage centerIn: iconImage
top: iconImage.top
topMargin: Theme.itemSpacingExtraSmall
} }
width: iconImage.width width: height
height: width height: parent.height - Theme.itemSpacingHuge
enabled: (searchLauncherModel.get(model.id).type === LauncherModel.Application) ? searchLauncherModel.get(model.id).isLaunching ? switcher.switchModel.getWindowIdForTitle(model.title) == 0 : false : false enabled: {
if(searchLauncherModel.get(model.id).type === LauncherModel.Application) {
if(searchLauncherModel.get(model.id).isLaunching)
return switcher.switchModel.getWindowIdForTitle(model.title) == 0
} else if (searchLauncherModel.get(model.id).type === LauncherModel.Folder && model.folderId > -1) {
if (searchLauncherModel.get(model.id).get(model.folderId).isLaunching)
return switcher.switchModel.getWindowIdForTitle(model.title) == 0
}
return false
}
Connections { Connections {
target: Lipstick.compositor target: Lipstick.compositor
onWindowAdded: { onWindowAdded: {
...@@ -330,14 +351,21 @@ Item { ...@@ -330,14 +351,21 @@ Item {
onClicked: { onClicked: {
switch (category ) { switch (category ) {
case "Application": case "Application":
var winId
if (searchLauncherModel.get(model.id).type !== LauncherModel.Folder) { if (searchLauncherModel.get(model.id).type !== LauncherModel.Folder) {
var winId = switcher.switchModel.getWindowIdForTitle(model.title) winId = switcher.switchModel.getWindowIdForTitle(model.title)
if (winId == 0 || !searchLauncherModel.get(model.id).isLaunching) if (winId == 0 || !searchLauncherModel.get(model.id).isLaunching)
searchLauncherModel.get(model.id).launchApplication() searchLauncherModel.get(model.id).launchApplication()
else else
Lipstick.compositor.windowToFront(winId) Lipstick.compositor.windowToFront(winId)
} else if (searchLauncherModel.get(model.id).type === LauncherModel.Folder && model.folderId > -1) {
winId = switcher.switchModel.getWindowIdForTitle(model.title)
if (winId == 0 || !searchLauncherModel.get(model.id).get(model.folderId).isLaunching)
searchLauncherModel.get(model.id).get(model.folderId).launchApplication()
else
Lipstick.compositor.windowToFront(winId)
} }
context.state=""
break break
case "Contact": case "Contact":
console.log("Call to person. Or open contextmenu where sms and call") console.log("Call to person. Or open contextmenu where sms and call")
......
...@@ -42,7 +42,7 @@ import "statusbar" ...@@ -42,7 +42,7 @@ import "statusbar"
Item { Item {
id: root id: root
z: 201 z: 201
height: Theme.itemHeightLarge height: Theme.itemHeightMedium
width: parent.width width: parent.width
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
enabled: !lockscreenVisible() enabled: !lockscreenVisible()
...@@ -54,6 +54,7 @@ Item { ...@@ -54,6 +54,7 @@ Item {
opacity: 0.5 opacity: 0.5
z: 200 z: 200
} }
MouseArea { MouseArea {
property int oldX property int oldX
property int oldY property int oldY
...@@ -65,7 +66,7 @@ Item { ...@@ -65,7 +66,7 @@ Item {
row.currentChild = row.childAt(mouseX, mouseY) row.currentChild = row.childAt(mouseX, mouseY)
row.currentChild.clicked() row.currentChild.clicked()
}else { }else {
row.currentChild = null row.currentChild = null
} }
} }
...@@ -194,10 +195,10 @@ Item { ...@@ -194,10 +195,10 @@ Item {
RowLayout { RowLayout {
id:row id:row
anchors.fill: statusbar anchors.fill: statusbar
spacing: root.height/4 spacing: Theme.itemSpacingSmall
property var currentChild property var currentChild
StatusbarItem { StatusbarItem {
iconSize: root.height/2 iconSize: Theme.itemHeightExtraSmall
source: (cellularSignalBars.value > 0) ? "image://theme/icon_cell" + cellularSignalBars.value : "image://theme/icon_cell1" source: (cellularSignalBars.value > 0) ? "image://theme/icon_cell" + cellularSignalBars.value : "image://theme/icon_cell1"
MouseArea{ MouseArea{
...@@ -213,33 +214,44 @@ Item { ...@@ -213,33 +214,44 @@ Item {
} }
StatusbarItem { StatusbarItem {
iconSize: root.height/2 iconSize: root.height
Label { Item {
id: tech anchors.centerIn: parent
width: root.height/4 width: parent.width
height: root.height/4 height: tech.font.pixelSize*2
font.pixelSize: root.height/4+root.height/5 Label {
font.bold: true id: tech
wrapMode: Text.ElideRight horizontalAlignment: Text.AlignHCenter
text: (cellularNetworkName.value !== "") ? cellularNetworkName.value.substring(0,3).toUpperCase() : "NA" verticalAlignment:Text.AlignBottom
} width: parent.width
height: paintedHeight
font.pixelSize: Theme.fontSizeSmall
elide:Text.ElideNone
maximumLineCount: 1
clip:true
text: (cellularNetworkName.value !== "") ? cellularNetworkName.value.substring(0,3).toUpperCase() : "NA"
}
Label { Label {
anchors.top: tech.bottom y: -contentHeight + font.pixelSize*2 + tech.y
anchors.topMargin: root.height/8 horizontalAlignment: Text.AlignHCenter
width: root.height/4 width: parent.width
height: root/height/4 height: paintedHeight
font.pixelSize: root.height/4+root.height/5 font.pixelSize: Theme.fontSizeSmall
text: { elide:Text.ElideNone
var techToG = {gprs: "2", egprs: "2.5", umts: "3", hspa: "3.5", lte: "4", unknown: "0"} maximumLineCount: 1
return techToG[cellularDataTechnology.value ? cellularDataTechnology.value : "unknown"] + "G" text: {
var techToG = {gprs: "2", egprs: "2.5", umts: "3", hspa: "3.5", lte: "4", unknown: "0"}
return techToG[cellularDataTechnology.value ? cellularDataTechnology.value : "unknown"] + "G"
}
} }
} }
panel: SimPanel {} panel: SimPanel {}
} }
StatusbarItem { StatusbarItem {
iconSize: root.height/2 id:wifiStatus
iconSize: Theme.itemHeightExtraSmall
source: { source: {
if (wlan.connected) { if (wlan.connected) {
if (networkManager.defaultRoute.type !== "wifi") if (networkManager.defaultRoute.type !== "wifi")
...@@ -265,40 +277,50 @@ Item { ...@@ -265,40 +277,50 @@ Item {
} }
StatusbarItem { StatusbarItem {
id: bluetootIndicator id: bluetootIndicator
iconSize: root.height/2 iconSize: Theme.itemHeightExtraSmall
source: (bluetoothConnected.value) ? "image://theme/icon_bt_focused" : "image://theme/icon_bt_normal" source: (bluetoothConnected.value) ? "image://theme/icon_bt_focused" : "image://theme/icon_bt_normal"
visible: bluetoothEnabled.value visible: bluetoothEnabled.value
} }
StatusbarItem { StatusbarItem {
iconSize: root.height/2 iconSize: Theme.itemHeightExtraSmall
source: "image://theme/icon_nfc_normal" source: "image://theme/icon_nfc_normal"
} }
StatusbarItem { StatusbarItem {
iconSize: root.height/2 iconSize: Theme.itemHeightExtraSmall
source: "image://theme/icon_gps_normal" source: "image://theme/icon_gps_normal"
} }
StatusbarItem { StatusbarItem {
iconSize: root.height/2 iconSize: Theme.itemHeightExtraSmall
source: "image://theme/icon_play_pause" source: "image://theme/icon_play_pause"
} }
StatusbarItem { StatusbarItem {
iconSize: root.height/2 iconSize: root.height
anchors.verticalCenter: parent.verticalCenter Item {
Label { anchors.centerIn: parent
id: hours width: parent.width
width: root.height/4 height: hours.font.pixelSize*2
height: root.height/4 Label {
font.pixelSize: root.height/4+root.height/5 id: hours
text: Qt.formatDateTime(wallClock.time, "hh") horizontalAlignment: Text.AlignHCenter
} verticalAlignment:Text.AlignBottom
Label { width: parent.width
id: minutes height: paintedHeight
anchors.top: hours.bottom font.pixelSize: Theme.fontSizeSmall
anchors.topMargin: root.height/8 elide:Text.ElideNone
width: root.height/4 maximumLineCount: 1
height: root.height/4 text: Qt.formatDateTime(wallClock.time, "hh")
font.pixelSize: root.height/4+root.height/5 }
text: Qt.formatDateTime(wallClock.time, "mm") Label {
id: minutes
y: -contentHeight + font.pixelSize*2 + hours.y
horizontalAlignment: Text.AlignHCenter
width: parent.width
height: paintedHeight
font.pixelSize: Theme.fontSizeSmall
elide:Text.ElideNone
maximumLineCount: 1
text: Qt.formatDateTime(wallClock.time, "mm")
}
} }
} }
......
...@@ -100,7 +100,7 @@ MouseArea { ...@@ -100,7 +100,7 @@ MouseArea {
CloseButton { CloseButton {
id: closeButton id: closeButton
width: parent.width/4 width: rotateWindowContent ? parent.width/4 :parent.height/4
height: width height: width
Behavior on scale { PropertyAnimation { duration: 300; easing.type: Easing.OutBack } } Behavior on scale { PropertyAnimation { duration: 300; easing.type: Easing.OutBack } }
scale: switcherRoot.closeMode ? 1 : 0 scale: switcherRoot.closeMode ? 1 : 0
......
...@@ -5,31 +5,84 @@ import QtQuick.Controls.Styles.Nemo 1.0 ...@@ -5,31 +5,84 @@ import QtQuick.Controls.Styles.Nemo 1.0
MouseArea { MouseArea {
id: notifyArea id: notifyArea
height: childrenRect.height height: Theme.itemHeightExtraLarge
width: parent.width width: parent.width
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 int iconSize: Theme.itemHeightExtraLarge 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.target: notifyArea
drag.axis: Drag.XAxis drag.axis: Drag.XAxis
drag.minimumX: 0-Theme.itemHeightMedium drag.minimumX: -notifyArea.width
drag.maximumX: notifyArea.width drag.maximumX: notifyArea.width
drag.onActiveChanged: { drag.onActiveChanged: {
if(!drag.active ) { if(!drag.active ) {
if((notifyArea.x > notifyArea.width/3)) { if((notifyArea.x > swipeTreshold)) {
slideAnimation.start() slideAnimation.start()
}else slideBackAnimation.start() }else if (notifyArea.x < -swipeTreshold){
slideReverseAnimation.start()
} else {
slideBackAnimation.start()
}
}
}
function refreshTimestamp() {
var seconds = Math.floor((new Date() - modelData.timestamp) / 1000)
var years = Math.floor(seconds / (365*24*60*60))
var months = Math.floor(seconds / (30*24*60*60))
var days = Math.floor(seconds / (24*60*60))
var hours = Math.floor(seconds / (60*60))
var minutes = Math.floor(seconds / 60)
if (years >= 1) {
if(years > 1) {
timeAgo = years + " " + qsTr("years ago")
} else {
timeAgo = years + " " + qsTr("year ago")
}
}else if (months >= 1) {
if (months > 1) {
timeAgo = months +" " + qsTr("months ago")
} else {
timeAgo = months +" " + qsTr("month ago")
}
}else if (days >= 1) {
if (days > 1) {
timeAgo = days + " " + qsTr("days ago")
} else {
timeAgo = days + " " + qsTr("day ago")
}
}else if (hours >= 1) {
if (hours > 1) {
timeAgo = hours + " " + qsTr("hours ago")
} else {
timeAgo = hours + " " + qsTr("hour ago")
}
} else if (minutes >= 1) {
if (minutes > 1) {
timeAgo = minutes + " " + qsTr("minutes ago")
} else {
timeAgo = minutes + " " + qsTr("minute ago")
}
} else {
timeAgo = qsTr("Just now")
} }
} }
onClicked: { onClicked: {
if (modelData.userRemovable) { if (modelData.userRemovable) {
slideAnimation.start() slideAnimation.start()
} else {
modelData.actionInvoked("default")
} }
} }
NumberAnimation { NumberAnimation {
...@@ -42,6 +95,16 @@ MouseArea { ...@@ -42,6 +95,16 @@ MouseArea {
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
onStopped: modelData.actionInvoked("default") onStopped: modelData.actionInvoked("default")
} }
NumberAnimation {
id:slideReverseAnimation
target: notifyArea
property: "x"
duration: 200
from: notifyArea.x
to: -notifyArea.width
easing.type: Easing.InOutQuad
onStopped: modelData.removeRequested()
}
NumberAnimation { NumberAnimation {
id:slideBackAnimation id:slideBackAnimation
target: notifyArea target: notifyArea
...@@ -53,10 +116,12 @@ MouseArea { ...@@ -53,10 +116,12 @@ MouseArea {
} }
Rectangle { Rectangle {
id:pressBg
anchors.fill: parent anchors.fill: parent
color: "#11ffffff" color: Theme.fillColor
visible: notifyArea.pressed visible: notifyArea.pressed
radius: Theme.itemSpacingMedium radius: Theme.itemSpacingMedium
opacity: 0.1
} }
Image { Image {
...@@ -68,13 +133,21 @@ MouseArea { ...@@ -68,13 +133,21 @@ MouseArea {
anchors{ anchors{
left: parent.left left: parent.left
leftMargin: Theme.itemSpacingLarge leftMargin: Theme.itemSpacingLarge
verticalCenter:parent.verticalCenter
} }
source: { source: {
if (modelData.icon) if (modelData.icon) {
return "image://theme/" + modelData.icon if(modelData.icon.indexOf("/") == 0)
else return "file://" + modelData.icon
return defaultIcon else
return "image://theme/" + modelData.icon
} else if (modelData.appIcon) {
if(modelData.appIcon.indexOf("/") == 0)
return "file://" + modelData.appIcon
else
return "image://theme/" + modelData.appIcon
} else return defaultIcon
} }
onStatusChanged: { onStatusChanged: {
if (appIcon.status == Image.Error) { if (appIcon.status == Image.Error) {
...@@ -82,48 +155,65 @@ MouseArea { ...@@ -82,48 +155,65 @@ MouseArea {
} }
} }
} }
Label { Column {
id: appName id:labelColumn
text: modelData.appName
width: (parent.width-appIcon.width)-Theme.itemSpacingHuge
color: Theme.textColor
font.pixelSize: Theme.fontSizeMedium
font.capitalization: Font.AllUppercase
font.bold: true
anchors { anchors {
left: appIcon.right left:appIcon.right
top: parent.top
leftMargin: Theme.itemSpacingLarge leftMargin: Theme.itemSpacingLarge
verticalCenter: appIcon.verticalCenter
} }
} height: parent.height
width: parent.width-appIcon.width-Theme.itemSpacingLarge*2
Label { Label {
id: appSummary id: appName
text: modelData.summary text: modelData.appName
width: (parent.width-appIcon.width)-Theme.itemSpacingHuge width: Math.min(implicitWidth, parent.width-appTimestamp.width-Theme.itemSpacingSmall)
color: Theme.textColor color: Theme.textColor
font.pixelSize: Theme.fontSizeSmall elide: Text.ElideRight
//font.bold :true font.pixelSize: Theme.fontSizeSmall
//font.capitalization: Font.AllUppercase anchors {
left: parent.left
}
}
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()
}
anchors{ Label {
left: appName.left id: appSummary
top: appName.bottom text: modelData.summary || modelData.previewSummary
topMargin: Theme.itemSpacingSmall width: parent.width-Theme.itemSpacingHuge
color: Theme.textColor
font.pixelSize: Theme.fontSizeTiny
anchors{
left: parent.left
}
maximumLineCount: 1
elide: Text.ElideRight
} }
elide: Text.ElideRight
}
Label { Label {
id: appBody id: appBody
width: (parent.width-appIcon.width)-Theme.itemSpacingHuge width: parent.width-Theme.itemSpacingHuge
text: modelData.body text: modelData.body || modelData.previewBody
color: Theme.textColor color: Theme.textColor
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeTiny
anchors{ anchors{
left: appName.left left: parent.left
top: appSummary.bottom }
maximumLineCount: 1
elide: Text.ElideRight
} }
elide: Text.ElideRight
} }
} }
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
// Copyright (C) 2012 Jolla Ltd. // Copyright (C) 2012 Jolla Ltd.
// Contact: Vesa Halttunen <vesa.halttunen@jollamobile.com> // Contact: Vesa Halttunen <vesa.halttunen@jollamobile.com>
import QtQuick 2.0 import QtQuick 2.6
import org.nemomobile.lipstick 0.1 import org.nemomobile.lipstick 0.1
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
...@@ -43,7 +43,7 @@ Item { ...@@ -43,7 +43,7 @@ Item {
MouseArea { MouseArea {
id: notificationArea id: notificationArea
property int notificationHeight: Theme.itemHeightExtraLarge property int notificationHeight: Theme.itemHeightLarge
property int notificationMargin: Theme.itemSpacingExtraSmall property int notificationMargin: Theme.itemSpacingExtraSmall
property int notificationIconSize: Theme.itemHeightMedium property int notificationIconSize: Theme.itemHeightMedium
anchors.top: parent.top anchors.top: parent.top
...@@ -122,6 +122,7 @@ Item { ...@@ -122,6 +122,7 @@ Item {
Image { Image {
id: icon id: icon
property string defaultIcon: "/usr/share/lipstick-glacier-home-qt5/qml/images/notification-circle.png"
anchors { anchors {
top: parent.top top: parent.top
left: parent.left left: parent.left
...@@ -130,21 +131,41 @@ Item { ...@@ -130,21 +131,41 @@ Item {
} }
width: notificationArea.notificationIconSize width: notificationArea.notificationIconSize
height: width height: width
source: "/usr/share/lipstick-glacier-home-qt5/qml/images/notification-circle.png" source: {
if(notificationPreviewPresenter.notification) {
if (notificationPreviewPresenter.notification.icon) {
if (notificationPreviewPresenter.notification.icon.indexOf("/") == 0)
return "file://" + notificationPreviewPresenter.notification.icon
else
return "image://theme/" + notificationPreviewPresenter.notification.icon
}else if (notificationPreviewPresenter.notification.appIcon) {
if (notificationPreviewPresenter.notification.appIcon.indexOf("/") == 0)
return "file://" + notificationPreviewPresenter.notification.appIcon
else
return "image://theme/" + notificationPreviewPresenter.notification.appIcon
} else return defaultIcon
} else return defaultIcon
}
onStatusChanged: {
if (icon.status == Image.Error) {
icon.source = defaultIcon
}
}
} }
Label { Label {
id: summary id: summary
anchors { anchors {
top: parent.top top: icon.top
left: icon.right left: icon.right
right: parent.right right: parent.right
topMargin: notificationArea.notificationMargin topMargin: notificationArea.notificationMargin
leftMargin: notificationArea.notificationMargin*2 leftMargin: notificationArea.notificationMargin*2
rightMargin: notificationArea.notificationMargin rightMargin: notificationArea.notificationMargin
//bottomMargin: notificationArea.notificationMargin
} }
font.pixelSize: Theme.fontSizeMedium height: if(!text) 0
font.pixelSize: Theme.fontSizeTiny
text: notificationPreviewPresenter.notification != null ? notificationPreviewPresenter.notification.previewSummary : "" text: notificationPreviewPresenter.notification != null ? notificationPreviewPresenter.notification.previewSummary : ""
color: Theme.textColor color: Theme.textColor
clip: true clip: true
...@@ -158,10 +179,8 @@ Item { ...@@ -158,10 +179,8 @@ Item {
left: summary.left left: summary.left
right: summary.right right: summary.right
} }
font { height: if(!text) 0
pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
bold: true
}
text: notificationPreviewPresenter.notification != null ? notificationPreviewPresenter.notification.previewBody : "" text: notificationPreviewPresenter.notification != null ? notificationPreviewPresenter.notification.previewBody : ""
color: Theme.textColor color: Theme.textColor
clip: true clip: true
......
...@@ -38,9 +38,9 @@ StatusbarItem { ...@@ -38,9 +38,9 @@ StatusbarItem {
} }
} }
iconSize: root.height/2 iconSize: Theme.itemHeightExtraSmall
panel: BatteryPanel {} panel: BatteryPanel {}
source: "/usr/share/lipstick-glacier-home-qt5/qml/images/battery"+chargeValue+".png" source: "/usr/share/lipstick-glacier-home-qt5/qml/images/battery"+chargeValue+".png" //+ (chargeValue === 0 ? "?red" : "")
Timer{ Timer{
id: chargingTimer id: chargingTimer
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
** **
****************************************************************************************/ ****************************************************************************************/
import QtQuick 2.0 import QtQuick 2.6
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
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
...@@ -46,6 +46,7 @@ Rectangle { ...@@ -46,6 +46,7 @@ Rectangle {
onClick: { onClick: {
panel_loader.sourceComponent = parent.panel panel_loader.sourceComponent = parent.panel
panel_loader.visible = !panel_loader.visible panel_loader.visible = !panel_loader.visible
row.currentChild._reopenTimer.start()
row.currentChild=null row.currentChild=null
} }
...@@ -55,24 +56,20 @@ Rectangle { ...@@ -55,24 +56,20 @@ Rectangle {
Rectangle{ Rectangle{
anchors.fill: parent anchors.fill: parent
color: "#313131" color: Theme.fillDarkColor
opacity: 0.3 opacity: 0.3
} }
InverseMouseArea { InverseMouseArea {
anchors.fill: parent anchors.fill: parent
enabled: parent.visible enabled: parent.visible
parent:commonPanel
onPressed: { onPressed: {
parent.click() parent.click()
} }
} }
MouseArea {
id:mouseArea
anchors.fill:parent
onClicked: parent.click()
}
clip: true clip: true
default property alias contentItem: dataColumn.children default property alias contentItem: dataColumn.children
...@@ -94,8 +91,7 @@ Rectangle { ...@@ -94,8 +91,7 @@ Rectangle {
} }
wrapMode: Text.Wrap wrapMode: Text.Wrap
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
font.bold: true color: Theme.textColor
color: "#ffffff"
} }
CheckBox { CheckBox {
...@@ -119,7 +115,7 @@ Rectangle { ...@@ -119,7 +115,7 @@ Rectangle {
topMargin: Theme.itemSpacingMedium topMargin: Theme.itemSpacingMedium
} }
} }
//Just placeholder until IconButton will get merged
Image { Image {
id:settingsIcon id:settingsIcon
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
......
import QtQuick 2.0 import QtQuick 2.6
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
Item { Item {
property alias source: icon.source property alias source: icon.source
property alias pressed: mouse.pressed property alias pressed: mouse.pressed
property alias _reopenTimer: reopenTimer
property string panel_source property string panel_source
property Component panel property Component panel
property double iconSize property double iconSize
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
function clicked() { function clicked() {
if (panel_source !== "" && !panel) { if(reopenTimer.running){
panel_loader.source = panel_source panel_loader.visible = false
panel_loader.visible = !panel_loader.visible row.currentChild = null
} } else {
if (panel && panel_source === "") { if (panel_source !== "" && !panel) {
panel_loader.sourceComponent = panel panel_loader.source = panel_source
panel_loader.visible = !panel_loader.visible panel_loader.visible = !panel_loader.visible
}
if (panel && panel_source === "") {
panel_loader.sourceComponent = panel
panel_loader.visible = !panel_loader.visible
}
} }
} }
Rectangle{ Rectangle{
anchors.fill:parent anchors.fill:parent
opacity: 0.8 opacity: 0.6
color: Theme.fillDarkColor color: Theme.fillDarkColor
visible: panel_loader.visible && (panel_loader.sourceComponent == panel) visible: panel_loader.visible && (panel_loader.sourceComponent == panel)
} }
...@@ -30,6 +36,7 @@ Item { ...@@ -30,6 +36,7 @@ Item {
Image { Image {
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
height: iconSize height: iconSize
width: iconSize
id: icon id: icon
anchors.centerIn: parent anchors.centerIn: parent
} }
...@@ -41,5 +48,10 @@ Item { ...@@ -41,5 +48,10 @@ Item {
enabled: !lockscreenVisible() enabled: !lockscreenVisible()
onClicked: parent.clicked() onClicked: parent.clicked()
} }
Timer {
id: reopenTimer
interval: 300
running: false
}
} }
...@@ -38,12 +38,12 @@ import MeeGo.Connman 0.2 ...@@ -38,12 +38,12 @@ import MeeGo.Connman 0.2
Component { Component {
CommonPanel { CommonPanel {
id: wifiPanel id: wifiPanel
name: "Wifi" name: qsTr("Wifi")
switcherEnabled: true switcherEnabled: true
switcherChecked: wifimodel.powered switcherChecked: wifimodel.powered
onSwitcherCheckedChanged: { onSwitcherCheckedChanged: {
wifimodel.setPowered(switcherChecked) wifimodel.setPowered(switcherChecked)
} }
property list<QtObject> _data: [ property list<QtObject> _data: [
...@@ -53,9 +53,12 @@ Component { ...@@ -53,9 +53,12 @@ Component {
} }
] ]
Repeater { ListView {
anchors.top: parent.top anchors.top: parent.top
model: wifimodel model: wifimodel
width: parent.width
height: wifiPanel.height
clip: true
delegate: Item { delegate: Item {
width: wifiPanel.width width: wifiPanel.width
height: Theme.itemHeightSmall height: Theme.itemHeightSmall
...@@ -76,7 +79,7 @@ Component { ...@@ -76,7 +79,7 @@ Component {
spacing: Theme.itemSpacingSmall spacing: Theme.itemSpacingSmall
Image { Image {
id: statusImage id: statusImage
source: (getStrengthIndex(modelData.strength) === "0")? "image://theme/icon_wifi_0" : (modelData.state === "online" ? "image://theme/icon_wifi_focused" : "image://theme/icon_wifi_normal")+ getStrengthIndex(modelData.strength) source: (getStrengthIndex(modelData.strength) === "0")? "image://theme/icon_wifi_0" : (modelData.state === "online" ? "image://theme/icon_wifi_focused" : "image://theme/icon_wifi_normal")+ getStrengthIndex(modelData.strength)
} }
Label { Label {
......
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