Skip to content

Commit

Permalink
Merge pull request #64 from eekkelund/master
Browse files Browse the repository at this point in the history
[Scaling][Notification][Search] Fix scaling to use newly calculated Theme.sizes
  • Loading branch information
neochapay authored Sep 18, 2017
2 parents 354a94d + 32b7b3b commit a15c1f8
Show file tree
Hide file tree
Showing 15 changed files with 377 additions and 215 deletions.
4 changes: 2 additions & 2 deletions src/qml/AppLauncher.qml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ GridView {
property alias deleter: deleter
property var switcher: null
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 columns: Math.floor(parent.width / minCellSize)

Expand All @@ -55,7 +55,7 @@ GridView {
clip: true

onContentYChanged: {
if( contentY < -140 ) {
if( contentY < -Theme.itemHeightHuge*2 ) {
headerItem.visible = true;
timer.running = true;
}
Expand Down
65 changes: 21 additions & 44 deletions src/qml/AppSwitcher.qml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Item {
Flickable {
id: flickable
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 {
height: flickable.contentHeight > flickable.height ? flickable.contentHeight : flickable.height
width: flickable.width
Expand All @@ -88,17 +88,17 @@ Item {

anchors {
top: parent.top
topMargin: closeMode ? Theme.itemSpacingLarge : 0
topMargin: closeMode ? Theme.itemSpacingLarge : Theme.itemSpacingSmall
bottom: toolBar.top
left: parent.left
// no right anchor to avoid double margin (complicated math)
leftMargin: closeMode ? Theme.itemSpacingLarge : 0
leftMargin: closeMode ? Theme.itemSpacingLarge : Theme.itemSpacingSmall
}

Grid {
id: gridview
columns: 2
spacing: closeMode ? Theme.itemSpacingLarge : 0
spacing: closeMode ? Theme.itemSpacingLarge : Theme.itemSpacingSmall
move: Transition {
NumberAnimation {
properties: "x,y"
Expand Down Expand Up @@ -159,26 +159,30 @@ Item {
closeMode = false
}
}
Rectangle {
Item {
id: toolBar
color: Theme.backgroundColor
border {
width: 1
color: Theme.fillDarkColor
}
z: 202
height:Theme.itemHeightExtraLarge + 2*padding
property int padding: Theme.itemSpacingSmall

anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
margins: -1
bottomMargin: switcherRoot.closeMode ? statusbar.height : -height
}

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 {
anchors {
top: parent.top
Expand All @@ -187,7 +191,7 @@ Item {
left: parent.left
bottom: parent.bottom
}
spacing: toolBar.padding*2
spacing: toolBar.padding * 2

Button {
id: toolBarDone
Expand All @@ -200,20 +204,6 @@ Item {
switcherRoot.closeMode = false;
}
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 {
Expand All @@ -222,28 +212,15 @@ Item {
top: parent.top
bottom: parent.bottom
}
width: parent.width / 2 - toolBar.padding
width: parent.width / 2 - toolBar.padding
onClicked: {
// TODO: use close animation inside item
for (var i = gridRepeater.count - 1; i >= 0; i--) {
gridRepeater.itemAt(i).close()
}
}
text: qsTr("Close All")
//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
}
}
primary: true
}
}
}
Expand Down
20 changes: 16 additions & 4 deletions src/qml/FeedsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ Flickable {
text: Qt.formatDateTime(wallClock.time, "dddd")
color: Theme.textColor
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Bold
anchors {
top: parent.top
horizontalCenter: parent.horizontalCenter
Expand All @@ -81,22 +80,35 @@ Flickable {
}
}
}
Timer {
id: timestampTimer
interval: 60000
running: true
repeat: true
}

Column {
id: notificationColumn
width: parent.width
anchors{
top: daterow.bottom
topMargin: Theme.itemSpacingHuge
topMargin: Theme.itemHeightLarge*1.5
}
spacing: Theme.itemSpacingHuge
spacing: Theme.itemSpacingExtraSmall
Repeater {
model: NotificationListModel {
id: notifmodel
}
delegate: NotificationItem{}
delegate: NotificationItem{
id: notifItem
Connections {
target: timestampTimer
onTriggered: notifItem.refreshTimestamp()
onRunningChanged: if (timestampTimer.running) notifItem.refreshTimestamp()
}
}
}
}
}
}

4 changes: 2 additions & 2 deletions src/qml/LauncherItemDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ Item {
Spinner {
id: spinnerr
anchors.centerIn: iconImage
width: iconWrapper.width
height: width
width: height
height: parent.height - Theme.itemSpacingHuge
enabled: (modelData.object.type === LauncherModel.Application) ? modelData.object.isLaunching ? switcher.switchModel.getWindowIdForTitle(modelData.object.title) == 0 : false : false

Connections {
Expand Down
12 changes: 8 additions & 4 deletions src/qml/Lockscreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,28 @@ Image {
right:parent.right
rightMargin: Theme.itemSpacingLarge
}
interactive:false
spacing: 0
interactive:DeviceLock.state !== DeviceLock.Locked
spacing: Theme.itemSpacingExtraSmall

model: NotificationListModel {
id: notifmodel
}
clip:true
delegate: NotificationItem {
height: 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: appIcon.verticalCenter
appName.anchors.top: null
appName.anchors.verticalCenter: labelColumn.verticalCenter
appBody.font.pixelSize: Theme.fontSizeTiny
appBody.visible: false
appTimestamp.visible: false
appSummary.visible: false
pressBg.visible: DeviceLock.state !== DeviceLock.Locked
pressBg.opacity: 0.3
}
}
}
1 change: 0 additions & 1 deletion src/qml/LockscreenClock.qml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ Rectangle {
font.pixelSize: Theme.fontSizeMedium
color: Theme.textColor
horizontalAlignment: Text.AlignHCenter
font.weight: Font.Bold
anchors {
horizontalCenter: parent.horizontalCenter
}
Expand Down
86 changes: 57 additions & 29 deletions src/qml/SearchListView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import QtQuick.Controls.Styles.Nemo 1.0
import org.nemomobile.contacts 1.0

Item {
id:rootItem
height: (searchField.text.length > 0 ? listView.height+searchField.height : searchField.height) + (visible ? Theme.itemSpacingHuge + margin.height : 0)
visible: false
anchors.bottomMargin:Theme.itemSpacingHuge
Expand All @@ -48,8 +49,10 @@ Item {


onVisibleChanged: {
if( visible) searchField.focus = true
else searchField.focus = false
if( visible){
searchField.focus = true
searchField.forceActiveFocus()
} else searchField.focus = false
oldHeight=height
}

Expand All @@ -68,25 +71,30 @@ Item {
rightMargin: Theme.itemSpacingMedium
bottomMargin:Theme.itemSpacingHuge
}
Image {
id:searchIcon
anchors.verticalCenter: parent.verticalCenter
width:height
height: searchField.height
fillMode: Image.PreserveAspectFit
source: "image://theme/search"
}
Image {
id:searchIcon
anchors.verticalCenter: parent.verticalCenter
width:height
height: searchField.height
fillMode: Image.PreserveAspectFit
source: "image://theme/search"
}

TextField {
id:searchField
width:parent.width - searchIcon.width - Theme.itemSpacingMedium
placeholderText: qsTr("Search")
Binding {
target: gridview
property: "searchString"
value: searchField.text.toLowerCase().trim()
TextField {
id:searchField
width:parent.width - searchIcon.width - Theme.itemSpacingMedium
placeholderText: qsTr("Search")
Binding {
target: gridview
property: "searchString"
value: searchField.text.toLowerCase().trim()
}
onTextChanged: {
if(tex.lenght>0) {
searchField.forceActiveFocus()
}
}
}
}

}
ListView {
Expand Down Expand Up @@ -180,7 +188,13 @@ Item {
var titles = []
var contacts = []
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) {
if(peopleModel.get(i).firstName && peopleModel.get(i).lastName) {
Expand Down Expand Up @@ -217,11 +231,12 @@ Item {
iconTitle = filteredTitles[i].iconTitle
iconId = filteredTitles[i].iconSource
var id = filteredTitles[i].id
var folderId = filteredTitles[i].folderId
category = filteredTitles[i].category
found = existingTitleObject.hasOwnProperty(iconTitle)
if (!found) {
// 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) {
Expand Down Expand Up @@ -273,13 +288,19 @@ Item {
id: spinner
anchors {
centerIn: iconImage
top: iconImage.top
topMargin: Theme.itemSpacingExtraSmall
}
width: iconImage.width
height: width
enabled: (searchLauncherModel.get(model.id).type === LauncherModel.Application) ? searchLauncherModel.get(model.id).isLaunching ? switcher.switchModel.getWindowIdForTitle(model.title) == 0 : false : false

width: height
height: parent.height - Theme.itemSpacingHuge
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 {
target: Lipstick.compositor
onWindowAdded: {
Expand Down Expand Up @@ -330,14 +351,21 @@ Item {
onClicked: {
switch (category ) {
case "Application":
var winId
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)
searchLauncherModel.get(model.id).launchApplication()
else
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
case "Contact":
console.log("Call to person. Or open contextmenu where sms and call")
Expand Down
Loading

0 comments on commit a15c1f8

Please sign in to comment.